Rollup merge of #136296 - RalfJung:float-min-max, r=tgross35

float::min/max: mention the non-determinism around signed 0

Turns out this can actually produce different results on different machines [in practice](https://github.com/rust-lang/rust/issues/83984#issuecomment-2623859230); that seems worth documenting. I assume LLVM will happily const-fold these operations so so there could be different results for the same input even on the same machine, depending on whether things get const-folded or not.

`@nikic` I remember there was an LLVM soundness fix regarding scalar evolution for loops that had to recognize certain operations as non-deterministic... it seems to me that pass would also have to avoid predicting the result of `llvm.{min,max}num`, for the same reason?

r? `@tgross35`
Cc `@rust-lang/libs-api`

If this lands we should also make Miri non-deterministic here.

Fixes https://github.com/rust-lang/rust/issues/83984
This commit is contained in:
Jacob Pratt 2025-01-31 00:25:38 -05:00 committed by GitHub
commit e3aa5e494e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

Diff Content Not Available