"be consistent" | |
PerlMonks |
Re: Determining the minimum representable increment/decrement possible?by davido (Cardinal) |
on Jun 15, 2016 at 15:52 UTC ( [id://1165741]=note: print w/replies, xml ) | Need Help?? |
This post is based on the following theory: <theory>Since Perl's floating point precision is constrained by what can be stored in an NV, the minimal change to a floating point value that Perl should be able to accommodate would be obtained by twiddling the least significant bit in an NV.</theory> Here's an example (which may be completely bogus) of what I'm getting at. Unfortunately my understanding of Perl's internal representation of a float within an NV is limited, so this approach is at best just intended to explore the possibility.
The output:
So it would appear that the least significant change that can be represented in an NV that was holding the decimal floating point value of 0.5 would be 0.00000000000000011102230246251565. In my example, I started with a value that I knew could be represented precisely in native base-2 format, and essentially ended up with another number that can be stored precisely in native base-2. It just happens to be a number that is rather ugly in base 10. Apologies if this is getting off into the wrong field of weeds, or if my example inadequately implements the theory I put forth, but the topic seemed interesting and I thought I'd post my exploration. Dave
In Section
Seekers of Perl Wisdom
|
|