Ask HN: How do you prove two machines computed the same float32 result?

5 points by Swapnopam ↗ HN
Not approximately the same. Bit-identical. Across different hardware vendors, kernel versions, or driver stacks.

Logs and weight checksums don't answer this. Looking for anyone who has a working production answer or has hit this wall.

3 comments

[ 0.21 ms ] story [ 12.3 ms ] thread
cast it to an integer and check for equality?

requiring bit identical goes beyond what floats promise though.

Like a-dab wrote: its impossible

With some numbers you can, because the binary representation works, but others like 0.3 have an reputation to be differemt what someone might expect.

If you need precise results, do not use floats or define how precise your numbers need to be and round them to that precision before storing or displaying them

Simple operations shoud be fine, but micros sometimes have bugs. Also, if you compile with fast-math the compiler may take shortcuts and kill the bit exact result.

For complex numbers, I'd not be so sure. Division is implemented diferently...