|
Posted by gamo on July 6, 2007, 4:53 am
Please log in for more thread options
On Fri, 6 Jul 2007, Mumia W. wrote:
> On 07/05/2007 10:08 PM, Sisyphus wrote:
> >
> > > On 07/05/2007 04:36 AM, gamo wrote:
> > > > On Thu, 5 Jul 2007, Sisyphus wrote:
> > > >
> > > > > > Hello
> > > > > >
> > > > > > I found a problem related with calculating Catalan's numbers
> > > > > >
> > > > > What is the problem ? (I don't see it.)
> > > > >
> > > > > Cheers,
> > > > > Rob
> > > >
> > > > The problem is that this output lacks precision aparently
> > > >
> > > > 216489185503133990863274261791925599831200000000000000000000
> > > > 853702637172735926234421145556838686126800000000000000000000
> > > > 3366939372774715522158184331074634818182000000000000000000000
> > > > [...]
> > >
> > > You can set the "accuracy" of the bignum module. Read "perldoc bignum"
> > >
> >
> > Oh, yes ... I should've realised.
> >
> > Is that a bug in bignum ? I didn't see it documented anywhere that there was
> > a default "accuracy" set.
> > The same issue does not arise if you explicitly 'use Math::BigInt;'.
> >
> > Cheers,
> > Rob
>
> Yes, I also noticed that Math::BigInt (or "bigint") works right out of the
> box.
>
> Evidently "bignum" has more to do and is more complicated, and consequently,
> has more bugs. In this case, I don't know if the bug is in the documentation
> or code; however, I think that the default accuracy should be given in the
> POD.
>
> Nonetheless, it can be queried by calling Math::BigFloat->accuracy().
>
> Gamo, why did you choose bignum rather than bigint?
>
>
Because it's simple to use. It overloads any operation.
Fire and forget. No OOP nor especial commands.
If I need to use only BigInt, I'll check GMP::Mpz or Math::PARI, too.
PARI is another kind of animal, because it does functions.
Best regards,
--
http://www.telecable.es/personales/gamo/ perl -e 'print 111_111_111**2,"\n";'
|