Pathologically Eclectic Rubbish Lister PerlMonks

### Re^3: Determining the minimum representable increment/decrement possible?

by ExReg (Priest)
 on Jun 15, 2016 at 18:52 UTC ( #1165777=note: print w/replies, xml ) Need Help??

Excuse me while I clear out my cranial flatus. I was not forcing the maximum precision. I was using the default. If I add the printf "%25.32" as dvido had I would have gotten slightly different results:

```0100001110111101100010001110100001001000001011011111000110101110 - 1.9
+041105342991886e+258

1100001110111101100010001110100001001000001011011111000110101110 - 1.9
+041105342991888e+258

It would appear that in this case, 1.9041105342991887e+258 is not possible to store. Using all 53 bits of mantissa, I still get about 15.95 digits instead of the 14. Each case will be different and require converting to binary, twiddling the bits, and seeing what you get.

Replies are listed 'Best First'.
Re^4: Determining the minimum representable increment/decrement possible?
by davido (Cardinal) on Jun 15, 2016 at 19:36 UTC

It would appear that in this case, 1.9041105342991887e+258 is not possible to store.

That is because 1.9041105342991887e+258 does not fit into m/2^n, and therefore cannot be represented precisely in base 2. You would need a couple more bits to push the rounding error further out, but that's just kicking the can down the road.

In other words, the binary representation of this floating point value results in a non-terminating sequence, much as 1/3rd results in a non-terminating sequence in base 10.

Dave

Very true. But since perl is using double precision on my machine, you will never get that number. You would need quad precision to represent 1.9041105342991887e+258.

Ignore this. I'm seeing things.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1165777]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-09-28 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?