Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Arithmetic on numbers bigger than 1<<31

by zude (Scribe)
on May 13, 2004 at 22:40 UTC ( [id://353233]=note: print w/replies, xml ) Need Help??


in reply to Arithmetic on numbers bigger than 1<<31

The problem is that the "%d" implies a conversion to a bitwise integer,and IMHO perl is extremely broken in this regard.

Anything larger than 2**32-1 is converted to 2**32-1 (aka -1).

Anything smaller than -2**31 is converted to 2**31 (aka -2**31).

Nothing else works this way. Certainly not libm.

Whatever, it can really screw you if you aren't careful:

(0xFFFFFFFF+1)&0xFFFFFFFF == 0xFFFFFFFF and die "Database wiped\n" Database wiped
I hate it when that happens.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://353233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found