Skip to content

Commit 90b8981

Browse files
committed
Simplify is_subnormal tests
1 parent f5dc702 commit 90b8981

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/float.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2387,20 +2387,16 @@ mod tests {
23872387

23882388
#[cfg(any(feature = "std", feature = "libm"))]
23892389
fn test_subnormal<F: crate::float::Float + ::core::fmt::Debug>() {
2390-
let lower_than_min: F = F::from(1.0e-308_f64).unwrap();
2390+
let min_positive = F::min_positive_value();
2391+
let lower_than_min = min_positive / F::from(2.0f32).unwrap();
2392+
assert!(!min_positive.is_subnormal());
23912393
assert!(lower_than_min.is_subnormal());
23922394
}
23932395

23942396
#[test]
23952397
#[cfg(any(feature = "std", feature = "libm"))]
23962398
fn subnormal() {
23972399
test_subnormal::<f64>();
2398-
}
2399-
2400-
#[test]
2401-
#[should_panic]
2402-
#[cfg(any(feature = "std", feature = "libm"))]
2403-
fn subnormal_f32() {
24042400
test_subnormal::<f32>();
24052401
}
24062402
}

0 commit comments

Comments
 (0)