Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-01-26 14:17:54
John Maddock wrote:
>The number types I have can all be plugged straight into Boost.Rational.
>However, performance compared to say mpq_t is truly terrible. Not sure if
>it's Boost.Rational or Boost's gcd that's the bottleneck, though I suspect
>both could be improved.
Because I use lazy exact this may not be that big of a concern. It is possible for an entire polygon clipping operation to run through and never once actually call the rational arithmetic. Using your bigint with boost rational is a much better option than simply using the result provided by long double even after my check for whether it satisfies my invariant has failed. I would be happy to add dependency on both boost libraries if it meant that by default my library was numerically robust without using gmp.
It sounds like we may need to rework Rational, however, to make it more useful for extended precision use cases. Perhaps you can specialize Rational's templates for your types in your library. You could then provide your expression templates as their return types.