|
Boost : |
Subject: Re: [boost] [units] - learning to use, continued :)
From: Janek Kozicki (janek_listy_at_[hidden])
Date: 2011-11-30 10:45:22
Paul A. Bristow said: (by the date of Wed, 30 Nov 2011 11:08:53 -0000)
> > - 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
> sandbox .
>
> 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
I'm using apcalc, a very nice software ;-)
933262154439441526816992388562667004907159682643816214685929638952175999932\
29915608941463976156518286253697920827223758251185210916864000000000000000000000000
> 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).
hmm, you are right. I probably will need to go into logs.
Boost.Units has no effect on runtime, it checks units during
compilation. So using them shouldn't affect at all.
I'm glad that I installed 1.48 with Steven's help. And now I can
convert my code to use units :)
first thing will be to figure out how to declare a type meter^-0.5
maybe my previous try that didn't work with boost 1.42 will start to work with 1.48:
typedef derived_dimension<length_base_dimension,root<2> >::type quantum_wavefunction_1D;
best regards
-- Janek Kozicki http://janek.kozicki.pl/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk