Floating-point output constraint mismatch
A fast operation returns a non-finite value and asin returns a value outside its endpoint range.
Program
#![feature(core_intrinsics)]
#![allow(internal_features)]
fn main() { unsafe {
let m = f32::MAX;
let r = std::intrinsics::fadd_fast(m, 0.0);
println!("fast_add={:08x} finite={}", r.to_bits(), r.is_finite());
let r = 1.0f32.asin();
println!("asin32={:08x} within_range={}", r.to_bits(), r.abs() <= std::f32::consts::FRAC_PI_2);
} }
Output
fast_add=ff800000 finite=false
asin32=3fc90fdf within_range=false
The _fast and _algebraic operations are documented to be nondeterministic.
@Forever119 please don't mix unrelated problems into a single issue.
The first one is indeed not a bug. "Fast" operations make basically no guarantees at all. Imprecisions near f32::MAX can easily lead to unexpected infinities.
The second one is odd -- we do have logic to clamp asin within its range:
https://github.com/rust-lang/miri/blob/ae67e03f5c64b489eb661fb77f7ae77f4a33de6b/src/math.rs#L213-L214
So something does seem to go wrong there.
Oh, seems we got the clamp range wrong for asin. For atan we used (-π/2, +π/2) but for asin we used [-π, +π]...