Honey wrote:
On Friday, 9 June 2017 at 16:07:36 UTC, ketmar wrote:
one of my calculated values is `-0.166667`, which has bit-pattern of
0xBE2AAAB7.
now, let's say i want to use this number in my code:
float v = -0.166667f;
writefln("%f 0x%08X", v, *cast(uint*)&v);
oooops. "-0.166667 0xBE2AAAC1". it's not the same! (and yes, it matters).
Try -0.16666685f.
it doesn't matter if i can find the decimal representation for the given
bit pattern or not. the whole post is about removing the need to rely on
lossy binary->decimal->binary conversions.