Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Floating point issue

by vitoco (Hermit)
on Aug 12, 2016 at 22:04 UTC ( [id://1169674]=note: print w/replies, xml ) Need Help??


in reply to Re: Floating point issue
in thread Floating point issue

Actually not. Just googled it... Thanks for the hint.

But what made me get confused was that it happened sometimes and wanted to know why.

Replies are listed 'Best First'.
Re^3: Floating point issue
by pryrt (Abbot) on Aug 12, 2016 at 22:09 UTC

    Depending on your starting value, sometimes the little tiny differences round to a value that Perl's default stringification will print differently than your expected precision, and sometimes they won't.

    If you want consistent precision in output, use sprintf or printf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-24 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found