The gist of it is that (a + b) - c becomes different from a + (b - c) and (a - c) + b.
While Rust picks a “fast” default that ensures non-trapping code is safe in this regard.
Zig on the other hand would make incorrect ordering UB which might not be immediately obviously wrong - it completely depends on the optimizations run, something which runs completely counter to notions of correctness.
lerno|2 years ago
The gist of it is that (a + b) - c becomes different from a + (b - c) and (a - c) + b.
While Rust picks a “fast” default that ensures non-trapping code is safe in this regard.
Zig on the other hand would make incorrect ordering UB which might not be immediately obviously wrong - it completely depends on the optimizations run, something which runs completely counter to notions of correctness.
prabhatexit0|2 years ago
nektro|2 years ago