https://lib.rs/crates/fast-floats
The crate exposes the fadd_fast (and similar) intrinsics to safe code behind the operator traits:
https://docs.rs/fast-floats/0.1.2/src/fast_floats/lib.rs.html#93-101
This is unsound because using NAN as an argument to one of those intrinsics produces poison:
https://llvm.org/docs/LangRef.html#fast-math-flags
Which can then be used to produce UB by using it "as an instruction operand that has any values that trigger undefined behavior":
https://llvm.org/docs/LangRef.html#poisonvalues
And one can directly create a NAN FF32 in safe code:
https://docs.rs/fast-floats/0.1.2/src/fast_floats/lib.rs.html#61
(As well as in other ways, like creating FF32s with 0.0 and dividing them.)
https://lib.rs/crates/fast-floats
The crate exposes the
fadd_fast(and similar) intrinsics to safe code behind the operator traits:https://docs.rs/fast-floats/0.1.2/src/fast_floats/lib.rs.html#93-101
This is unsound because using NAN as an argument to one of those intrinsics produces
poison:https://llvm.org/docs/LangRef.html#fast-math-flags
Which can then be used to produce UB by using it "as an instruction operand that has any values that trigger undefined behavior":
https://llvm.org/docs/LangRef.html#poisonvalues
And one can directly create a NAN
FF32in safe code:https://docs.rs/fast-floats/0.1.2/src/fast_floats/lib.rs.html#61
(As well as in other ways, like creating
FF32s with0.0and dividing them.)