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

Re^5: float values and operators

by dave_the_m (Monsignor)
on Aug 11, 2004 at 21:11 UTC ( [id://382094]=note: print w/replies, xml ) Need Help??


in reply to Re^4: float values and operators
in thread float values and operators

Hrm, that's what I get, too. So why doesn't the imprecision show up when you print the variables out?
Because print doesn't print the full precision of its args. That's what printf is for:
$ perl585 -e'print 26.6+0.2, "\n"' 26.8 $ perl585 -e'printf "%.20f\n ", 26.6+0.2' 26.80000000000000071054

Dave.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found