You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code prints some NaN with latest Miri (not yet synced into rustc):
fnmain(){let f = std::f64::consts::FRAC_PI_2;for _ in0..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?
The text was updated successfully, but these errors were encountered:
I don't think anything is actually guaranteed here, assuming the implementations follow the C spec. But if this is causing problems it's probably fine for Miri to ensure the nondeterminism is still bounded by the output domain, I think this is a much less likely failure mode compared to general imprecision.
This code prints some NaN with latest Miri (not yet synced into rustc):
The reason is that
f.sin()
can return values slightly above 1 due to the imprecision we add, and thenasin()
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 satisfyx <= 1.0
? Or shouldasin
be more accepting of values slightly above NaN?The text was updated successfully, but these errors were encountered: