test out of range condition using f64
to avoid imprecision due to rounding to f32
This commit is contained in:
parent
4c556dc9e7
commit
109c33ed0a
@ -200,16 +200,16 @@ mod tests {
|
||||
fn __fixsfsi(f: extern "C" fn(f32) -> i32,
|
||||
a: F32)
|
||||
-> Option<I32> {
|
||||
if a.0 > (i32::max_value() as f32) ||
|
||||
a.0 < (i32::min_value() as f32) || a.0.is_nan() {
|
||||
if (a.0 as f64) > (i32::max_value() as f64) ||
|
||||
(a.0 as f64) < (i32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I32(f(a.0))) }
|
||||
}
|
||||
fn __fixsfdi(f: extern "C" fn(f32) -> i64,
|
||||
a: F32)
|
||||
-> Option<I64> {
|
||||
if a.0 > (i64::max_value() as f32) ||
|
||||
a.0 < (i64::min_value() as f32) || a.0.is_nan() {
|
||||
if (a.0 as f64) > (i64::max_value() as f64) ||
|
||||
(a.0 as f64) < (i64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(I64(f(a.0))) }
|
||||
}
|
||||
@ -233,16 +233,16 @@ mod tests {
|
||||
fn __fixunssfsi(f: extern "C" fn(f32) -> u32,
|
||||
a: F32)
|
||||
-> Option<U32> {
|
||||
if a.0 > (u32::max_value() as f32) ||
|
||||
a.0 < (u32::min_value() as f32) || a.0.is_nan() {
|
||||
if (a.0 as f64) > (u32::max_value() as f64) ||
|
||||
(a.0 as f64) < (u32::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U32(f(a.0))) }
|
||||
}
|
||||
fn __fixunssfdi(f: extern "C" fn(f32) -> u64,
|
||||
a: F32)
|
||||
-> Option<U64> {
|
||||
if a.0 > (u64::max_value() as f32) ||
|
||||
a.0 < (u64::min_value() as f32) || a.0.is_nan() {
|
||||
if (a.0 as f64) > (u64::max_value() as f64) ||
|
||||
(a.0 as f64) < (u64::min_value() as f64) || a.0.is_nan() {
|
||||
None
|
||||
} else { Some(U64(f(a.0))) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user