Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Re: Re: Re: Filthy Floats

by TheoPetersen (Priest)
on Jul 16, 2001 at 21:58 UTC ( #97111=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Filthy Floats
in thread Filthy Floats

Then store the value as a string, an integer, or something else that will remain exact. If you put it in a floating point value (in Perl, Access, ODBC or whatever) then you will not get the exact value back, except in cases where the binary and decimal representations have the same value (such as zero).

As to the second point, this is not correctable, on any level. You can get closer to exact values by using more bits (thus the attraction of double over float) but the phenomenon is inherent to floating point representation in binary, not to any of the languages mentioned.


Comment on Re: Re: Re: Re: Re: Re: Filthy Floats

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-07-29 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls