3 ms·
Ask HN: How do you prove two machines computed the same float32 result?
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.
- a-dub 2mo agocast it to an integer and check for equality? requiring bit identical goes beyond what floats promise though.
- stop50 2mo agoLike 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
- gus_massa 2mo agoSimple 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...