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
The issue here is that fptoui (floating-point-to-unsigned-int) and fptosi(floating-point-to-signed-int) return poison when their (floating point) argument "does not fit"(quoting lang ref) in the return type.
our logic is at present:
fn tunc_u(f: f64) -> Option<u64> {
if (0u64 as f64) <= f && f <= (u64::MAX as f64) { Some(f as f64) } else { None }
}
If I change the <=s to < then the test behaves sensibly. I conclude that u64::MAX as f64 is too large to fit in a u64 because rounding, and the strange results we are seeing are poison.
The lower-bound check should surely be less-than-equal for the unsigned case,unclear for the signed case. A bit more investigation needed to pin this down exactly.
We have a test case for int -> float -> int roundtrips which displays some confusing behaviour. See comment in code highlighted here.
Originally posted by @mark-koch in #94 (comment)
The text was updated successfully, but these errors were encountered: