Click here to get back home

use bigmnum?

 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
use bigmnum? gamo 06-16-2006
---> Re: use bigmnum? harryfmudd [AT]...06-16-2006
Get Chitika Premium
Posted by gamo on June 16, 2006, 10:46 am
Please log in for more thread options


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-391487729-1150469208=:11351
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE


#!/usr/local/bin/perl -w

use bignum;

$fact=3D1;
for $i (2..1000){
$fact*=3D$i;
}
print "$fact\n";
$div =3D int ($fact/2003);
$resto =3D $fact - $div*2003;
# $resto =3D $fact % 2003;
print "$resto\n";

__END__
this should be 2, not 0 or $fact

TIA

--=20
http://www.telecable.es/personales/gamo/
S=F3lo hay 10 tipos de personas, las que saben binario y las que no
perl -e 'print 111_111_111**2,"\n";'
--8323328-391487729-1150469208=:11351--

Posted by harryfmudd [AT] comcast [DOT] on June 16, 2006, 10:55 pm
Please log in for more thread options


gamo wrote:

> #!/usr/local/bin/perl -w
>
> use bignum;
>
> $fact=1;
> for $i (2..1000){
> $fact*=$i;
> }
> print "$fact\n";
> $div = int ($fact/2003);

# This gives NaN for $div when I do it. Though I confess I am not
# sure why, as int appears to be overloaded. But if $div == NaN,

> $resto = $fact - $div*2003;

# is bound to give NaN as well. On the other hand,

$resto = $fact % 2003;

# gives 2 when I run it. So why not code it that way?

> print "$resto\n";
>
> __END__
> this should be 2, not 0 or $fact
>

When I see mysterious and unreproducable results, I always look at versions.

Me:
perl 5.8.6 (built from source)
bignum 0.17
Math::BigFloat 1.51
Math::BigInt 1.77
OS: Darwin 7.9.0 (or, really, Mac OS 10.3.9), though I do not believe
this has anything to do with it.

If you are out of date, you may wish to consider upgrading.

> TIA
>

Or TIO, in my case ;-)

Tom Wyant

Posted by gamo on June 17, 2006, 8:49 am
Please log in for more thread options


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1119329942-1150548589=:11922
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Fri, 16 Jun 2006, harryfmudd [AT] comcast [DOT] net wrote:

> gamo wrote:
>=20
> > #!/usr/local/bin/perl -w
> >=20
> > use bignum;
> >=20
> > $fact=3D1;
> > for $i (2..1000){
> > $fact*=3D$i;
> > }
> > print "$fact\n";
> > $div =3D int ($fact/2003);
>=20
> # This gives NaN for $div when I do it. Though I confess I am not
> # sure why, as int appears to be overloaded. But if $div =3D=3D NaN,
>=20
> > $resto =3D $fact - $div*2003;
>=20
> # is bound to give NaN as well. On the other hand,
>=20
> $resto =3D $fact % 2003;
>=20
> # gives 2 when I run it. So why not code it that way?

Because it says me:
Can't use an undefined value as an ARRAY reference at=20
/usr/local/lib/perl5/5.8.8/Math/BigInt/Calc.pm line 1068.

>=20
> > print "$resto\n";
> >=20
> > __END__
> > this should be 2, not 0 or $fact
> >=20
>=20
> When I see mysterious and unreproducable results, I always look at versio=
ns.
>=20
> Me:
> perl 5.8.6 (built from source)
> bignum 0.17
> Math::BigFloat 1.51
> Math::BigInt 1.77
> OS: Darwin 7.9.0 (or, really, Mac OS 10.3.9), though I do not believe thi=
s has
> anything to do with it.
>=20
> If you are out of date, you may wish to consider upgrading.
>=20

I'm using 5.8.8
and the modules that come with it.

Thank you very much.

> > TIA
> >=20
>=20
> Or TIO, in my case ;-)
>=20
> Tom Wyant
>=20

--=20
http://www.telecable.es/personales/gamo/
S=F3lo hay 10 tipos de personas, las que saben binario y las que no
perl -e 'print 111_111_111**2,"\n";'
--8323328-1119329942-1150548589=:11922--

Posted by harryfmudd [AT] comcast [DOT] on June 17, 2006, 9:34 pm
Please log in for more thread options


gamo wrote:
> On Fri, 16 Jun 2006, harryfmudd [AT] comcast [DOT] net wrote:
>
>
>>gamo wrote:
>>
>>
>>>#!/usr/local/bin/perl -w
>>>
>>>use bignum;
>>>
>>>$fact=1;
>>>for $i (2..1000){
>>> $fact*=$i;
>>>}
>>>print "$fact\n";
>>>$div = int ($fact/2003);
>>
>># This gives NaN for $div when I do it. Though I confess I am not
>># sure why, as int appears to be overloaded. But if $div == NaN,
>>
>>
>>>$resto = $fact - $div*2003;
>>
>># is bound to give NaN as well. On the other hand,
>>
>>$resto = $fact % 2003;
>>
>># gives 2 when I run it. So why not code it that way?
>
>
> Because it says me:
> Can't use an undefined value as an ARRAY reference at
> /usr/local/lib/perl5/5.8.8/Math/BigInt/Calc.pm line 1068.
>
>
>>>print "$resto\n";
>>>
>>>__END__
>>>this should be 2, not 0 or $fact
>>>
>>
>>When I see mysterious and unreproducable results, I always look at versions.
>>
>>Me:
>>perl 5.8.6 (built from source)
>>bignum 0.17
>>Math::BigFloat 1.51
>>Math::BigInt 1.77
>>OS: Darwin 7.9.0 (or, really, Mac OS 10.3.9), though I do not believe this has
>>anything to do with it.
>>
>>If you are out of date, you may wish to consider upgrading.
>>
>
>
> I'm using 5.8.8
> and the modules that come with it.
>
> Thank you very much.
>

According to Module::CoreList, 5.8.8 comes with the same bignum,
Math::BigFloat, and Math::BigInt I'm running. I don't imagine upgrading
myself to 5.8.8 overnight (though I'll have to sometime).

Maybe someone running your version of Perl can help. Did you build it
yourself, or get it from somewhere?

I'm grasping at straws, though.

Tom Wyant

Posted by gamo on June 18, 2006, 1:28 am
Please log in for more thread options


On Sat, 17 Jun 2006, harryfmudd [AT] comcast [DOT] net wrote:

> According to Module::CoreList, 5.8.8 comes with the same bignum,
> Math::BigFloat, and Math::BigInt I'm running. I don't imagine upgrading myself
> to 5.8.8 overnight (though I'll have to sometime).
>
> Maybe someone running your version of Perl can help. Did you build it
> yourself, or get it from somewhere?

I build it.

>
> I'm grasping at straws, though.
>
> Tom Wyant
>

Similar ThreadsPosted
Re: use bigmnum June 17, 2006, 8:40 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap