Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: float values and operators

by GreyGlass (Sexton)
on Aug 12, 2004 at 04:27 UTC ( [id://382165]=note: print w/replies, xml ) Need Help??


in reply to float values and operators

The theory was well illuminated by others. The nuts and bolts (or the bits) in this case are:
> perl -le "print unpack q/b*/, pack F, 36.8" 0110011001100110011001100110011001100110011001100100001000000010 > perl -le "print unpack q/b*/, pack F, 36.6+.2" 1110011001100110011001100110011001100110011001100100001000000010

As you can see, there is a bit of difference. The lowest-order bit, to be exact.

FYI: This, of course, is on Win32. On other platforms it may be different, both in encoding and the round-off error in the last bit.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-16 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found