develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle

Thread Previous | Thread Next
From:
Tels
Date:
July 23, 2001 12:12
Subject:
Re: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle
Message ID:
perl.perl5.porters-40810@nntp.perl.org
-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On 23-Jul-01 Tels tried to scribble about:
> -----BEGIN PGP SIGNED MESSAGE-----
> Moin Bryce,

>>And, Or, and Xor on two positive BigInts seem to work ok.  However, if
>>you throw in a negative operand you get some very strange behavior.  I'm

This is an interesting bug. I choose for now to make the result the same for
negatives than for positives, because:

Perl scalar:
at -1 -1
4294967295

In your own words:

"However, if you throw in a negative operand you get some very strange
behavior." - Indeed ;)

I am unsure how to repeat this. The result of -1 & -1 highly depends on the
width of a Perl scalar. Since Bigint is by definition "infinite width", the
result should probably be something like +inf :-) Seriously, I do not know
how to repeat Perl's behaviour without assuming a specific width. Anyway,
your program looking for -1 & -1 beeing 4294967295 will fail on any
platform not having 32 bit (like 64 bit).

Has anybody any comments or ideas on what to do?

Best wishes,

Tels


- -- 
perl -MMath::String -e 'print \
Math::String->from_number("215960156869840440586892398248"),"\n"'

 http://bloodgate.com/thief/     Thief - The Dark Project
 http://bloodgate.com/perl       My current Perl projects
 http://freedomforlinks.de       Fight for your right to link.
 PGP key available on http://bloodgate.com/tels.asc or via email 

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: latin1

iQEVAwUBO1x2GHcLPEOTuEwVAQFbdQf+JfoP1FL+YQxtMZcHZ18scqz0lqE5vWWy
02mGmB/dvXtXPMDkdUVZ+ygypKMHxdRMEu2fkfpXZ2BpYVuSH3wgQ2D0DDxXbdNy
fdecnpSRBMTkGwhrh7M2k3AbOGwYscZbQgPBNxrp/oJ5fxWNLdFeFIL7yRvcTJIG
JE8iyyF5CGA6fUw1vELWBP8yABQ6FW6JgW9iZNq2k9CW/bwMy3oztI4h0UgZDdPv
Jxl9TERs8ZBjevtUyPU86VhsgwB7P0jKOPe8Dvm0OBV08rINN2xtb9/qdZfd9IV5
EqHpOyT0YdEtzrUuwQbMR+1hnrgnnf9/UYPSgbVASYAJvw6sYEZtuA==
=yJ5q
-----END PGP SIGNATURE-----

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About