Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Simple adding numbers

by ig (Vicar)
on Mar 26, 2013 at 07:30 UTC ( [id://1025448]=note: print w/replies, xml ) Need Help??


in reply to Simple adding numbers

This is just another way of saying the same thing but in Perl 0.1 isn't the value you think it is. Try the following:

printf("%.64f\n", 0.1);

On my system it prints:

0.1000000000000000100000000000000000000000000000000000000000000000

Note the extra 1 in the 17th place. The result may be different on your system. It depends on how floating point numbers are stored. Different systems store them differently.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found