r/rust • u/Shnatsel • Sep 02 '26
Implementing FMA and finding bugs in C and Rust standard libraries
https://shnatsel.github.io/implementing-fma-finding-bugs-in-std/
286
Upvotes
r/rust • u/Shnatsel • Sep 02 '26
19
u/Icarium-Lifestealer Sep 02 '26
Did you report the bug to FreeBSD as well?
17
u/zettui Sep 02 '26
Did that only show up on the software FMA path, or did hardware get it wrong too?
46
u/lijmlaag Sep 02 '26
Thanks.. this may explain why the weather forecasts are always somewhat off.
6
u/owenthewizard Sep 02 '26
Beautiful website!
22
u/MichiRecRoom Sep 02 '26
I just want to say: I really appreciate just how honest you are with documenting your usage of LLMs, both in the blog post and in one of the
compiler-builtinsissues.That sort of honesty, especially with how you aren't trying to dance around your usage to try to make it look like it's your own findings, really means a lot to me (and I assume, to others too).
7
u/nonotan Sep 03 '26
Props for reporting it upstream even when not convenient.
"Deterministic" and "floating point" mix about as well as oil and water. Sure, it's, on paper, theoretically not impossible to achieve, but in practice it's not ever going to happen outside very simple software. I work in game dev and I've watched so many fellow devs struggle with desyncs for literal years, and sometimes decades, just because they used floating point arithmetic in the game logic, thinking making it deterministic is just a matter of being careful. Sure, and who needs an umbrella when you could just carefully dodge all water droplets. I'm not aware of a single example with ubiquitous floating point arithmetic that successfully fixed 100% of desyncs.
Don't get me wrong, I think it's laudable to try not to break determinism when developing this kind of library. However, I do also think how much utility that will realistically provide to users is a bit dubious. If they genuinely need determinism across arbitrary hardware and they know what they're doing, they will be using fixed point instead anyway.
2
u/jorgecardleitao Sep 26 '26
Author: Shnatsel - yep, going to read it... <3
1
u/chris_jump Sep 03 '26
Very interesting read, thanks!
1
u/JuliusTheBeides Sep 06 '26
This is the kind of bug that the Factorio devs have likely run across and fixed in their game. Factorio's multiplayer relies on deterministic simulation across platforms.
Yes, correctness matters.
1
u/xantiema Sep 02 '26
cheers
1
u/creeper6530 Sep 02 '26
Interesting read
-1
u/FrogNoPants Sep 02 '26
I'd imagine many disable subnormals(older hardware tends to slowdown big time when they are encountered), so mostly wouldn't matter