Subject: Re: [boost] [units] - learning to use, continued :)
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-11-30 06:08:53
> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Janek
> Sent: Tuesday, November 29, 2011 9:19 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [units] - learning to use, continued :)
> But still I am quite happy today, because I managed to get a correctly working plots of this
> oscillator, but without units, unfortunately. One small problem is that I couldn't get to higher
> because double precision has limited factorials.
> I would need a working factorial of 100! which currently seems unlikely. And my currently maximum
> I didn't check yet, but maybe boost has some arbitrary precision library, which would work with
> Boost.Units and boost::math::factorial ?
> So, for your pleasure I am presenting you with a harmonic oscillator code :)
> - find some arbitrary precision library, that will work with Units
> and VERY big factorials, like 100! or even better 1000!
There are indeed at least two related efforts on arbitrary precision library going on.
A multiprecision library by Christopher Kormanyos based on his e_float library which is in the
and, based on this, an extension to Boost.Math (already user-defined type ready and able to use NTL
and GMP) that John Maddock is currently busy working on.
These should allow you to calculate factorial 100! to a few hundred decimal digits.
For your amusement, 100! is (to 50 decimal digits)
100! = 9.332621544394415268169923885626670049071596826438162146859e+157
But I'm not at all sure that this is the way forward for your purpose. For example, in calculating
gamma functions, it is customary to use logs to avoid overflow.
And we need to make sure we can walk before we can run - combining arbitrary precision with
Boost.Units (where double precision is usually enough to represent the accuracy of physical things).
--- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk