-
Notifications
You must be signed in to change notification settings - Fork 391
Closed
Description
This code prints some NaN with latest Miri (not yet synced into rustc):
fn main() {
let f = std::f64::consts::FRAC_PI_2;
for _ in 0..64 {
println!("{}", (dbg!(f.sin()).asin() - std::f64::consts::FRAC_PI_2).abs());
}
}
The reason is that f.sin()
can return values slightly above 1 due to the imprecision we add, and then asin()
returns NaN. That seems undesirable.
@tgross35 is there some sort of guarantee that f.sin()
, while it can be imprecise, will always return values that strictly satisfy x <= 1.0
? Or should asin
be more accepting of values slightly above NaN?
Metadata
Metadata
Assignees
Labels
No labels