Click here to get back home

bignum 0.22

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
bignum 0.22 gamo 07-04-2007
`--> Re: bignum 0.22 José Luis Pérez...07-05-2007
Posted by gamo on July 5, 2007, 12:02 pm
Please log in for more thread options


On Thu, 5 Jul 2007, Mumia W. wrote:

> You can set the "accuracy" of the bignum module. Read "perldoc bignum"
>
> BTW, if you make fact() recursive and use the Memoize module, you can get a
> speed improvement--a /substantial/ speed improvement :-)
>
Thanks all of you.
This trick really really improve speed.

But if there is no previous knowledge that all numbers will be
integers I can not fix the precision or accuracy.

Cheers

Posted by xhoster on July 5, 2007, 12:38 pm
Please log in for more thread options


> On Thu, 5 Jul 2007, Mumia W. wrote:
>
> > You can set the "accuracy" of the bignum module. Read "perldoc bignum"
> >
> > BTW, if you make fact() recursive and use the Memoize module, you can
> > get a speed improvement--a /substantial/ speed improvement :-)
> >
> Thanks all of you.
> This trick really really improve speed.
>
> But if there is no previous knowledge that all numbers will be
> integers

Aren't Catalan numbers only defined on integers?

> I can not fix the precision or accuracy.

Choosing to leave the defaults in place is still a choice, and you should
understand what the consequences of that choice are. It is not for the
accuracy and precision to be infinite. They are still limited through
some confusing fall-back method.


Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB

Posted by Sisyphus on July 5, 2007, 11:08 pm
Please log in for more thread options



> 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


Posted by Mumia W. on July 6, 2007, 2:04 am
Please log in for more thread options


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?


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";'

Similar ThreadsPosted
Problem around bignum March 28, 2006, 6:04 am
bignum incompatible with loos_like_number ??? June 26, 2007, 10:05 pm
bignum incompatible with looks_like_number() ??? June 26, 2007, 10:17 pm
Error in perl module "bignum"... May 14, 2006, 4:31 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap