Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How does Perl handle arithmetic overflows?

by dave_the_m (Monsignor)
on Sep 08, 2016 at 10:56 UTC ( [id://1171386]=note: print w/replies, xml ) Need Help??


in reply to How does Perl handle arithmetic overflows?

Internally, perl changes the data type of variables where necessary/possible in arithmetic to try to avoid loss of precision and/or overflow. So for example on a typical 64-bit system, repeated $x += 1 will cause the internal type to change from being initially a signed 64-bit int, to an unsigned 64-bit, and finally to a double - at which point it doesn't overflow, but may lose precision.

The exact details of what types are used at what points depends on the platform.

Dave.

  • Comment on Re: How does Perl handle arithmetic overflows?

Replies are listed 'Best First'.
Re^2: How does Perl handle arithmetic overflows?
by f77coder (Beadle) on Sep 08, 2016 at 12:37 UTC

    Great, thank you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-24 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found