Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: Question on simple arithmetic using perl

by Marshall (Prior)
on Sep 29, 2011 at 03:29 UTC ( #928459=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Question on simple arithmetic using perl
in thread Question on simple arithmetic using perl

Yes, if you mean that a 64 bit floating point number has more significant bits in the mantissa than a 32 bit integer does, I agree. I leave looking up the definition of ANSI C long and double to the interested readers.

Update: I looked up what Microsoft did for storage in C. "int" and "long" are both 32 bits (other folks will assign 64 bits to a "long"). A MS "float" is 32 bits and MS "double" is 64 bits with 52 bit mantissa.

ANSI C Summary says: that an int will have at least 4 significant decimal digits and a long will have at least 9 significant decimal digits (see link for exact ANSI spec'd ranges). An int can be the same size as a long (bigger than minimum is ok).

A float has to have 6 decimal digits of precision and a double has a minimum of 10 decimal digits of precision. So a double is guaranteed to have at least one more decimal digit of precision than a long (10 vs 9).


Comment on Re^5: Question on simple arithmetic using perl

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2014-12-28 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls