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

Re: IEEE-754 calculation - best way?

by dave_the_m (Prior)
on Jan 30, 2013 at 22:27 UTC ( #1016165=note: print w/replies, xml ) Need Help??


in reply to IEEE-754 calculation - best way?

In perl, all fractional numbers, and most operations on them, are performed internally using "C" doubles. The artefacts you are seeing are from when you ask perl to convert that value into a string (e.g. with print, or when you try to eval a string). When perl stringifies a number, it does it to a particular default precision, for example to 15 decimal places. If you don't like this default, then yes, you'll need to use sprintf or similar.

Dave.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016165]
help
Chatterbox?
holli just tried to open a soda bottle with a bottleopener
[holli]: ok, that doesn't *sound* that bad
[Corion]: holli: Was it a "twist-to-open" soda bottle? Or a German Mehrweg bottle with a twisty cap?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2017-09-25 12:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?