File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2362,6 +2362,7 @@ mod tests {
2362
2362
assert ! ( p. is_sign_positive( ) ) ;
2363
2363
assert ! ( n. is_sign_negative( ) ) ;
2364
2364
assert ! ( nan. is_nan( ) ) ;
2365
+ assert ! ( !nan. is_subnormal( ) ) ;
2365
2366
2366
2367
assert_eq ! ( p, p. copysign( p) ) ;
2367
2368
assert_eq ! ( p. neg( ) , p. copysign( n) ) ;
@@ -2372,4 +2373,23 @@ mod tests {
2372
2373
assert ! ( nan. copysign( p) . is_sign_positive( ) ) ;
2373
2374
assert ! ( nan. copysign( n) . is_sign_negative( ) ) ;
2374
2375
}
2376
+
2377
+ #[ cfg( any( feature = "std" , feature = "libm" ) ) ]
2378
+ fn test_subnormal < F : crate :: float:: Float + :: core:: fmt:: Debug > ( ) {
2379
+ let lower_than_min: F = F :: from ( 1.0e-308_f64 ) . unwrap ( ) ;
2380
+ assert ! ( lower_than_min. is_subnormal( ) ) ;
2381
+ }
2382
+
2383
+ #[ test]
2384
+ #[ cfg( any( feature = "std" , feature = "libm" ) ) ]
2385
+ fn subnormal ( ) {
2386
+ test_subnormal :: < f64 > ( ) ;
2387
+ }
2388
+
2389
+ #[ test]
2390
+ #[ should_panic]
2391
+ #[ cfg( any( feature = "std" , feature = "libm" ) ) ]
2392
+ fn subnormal_f32 ( ) {
2393
+ test_subnormal :: < f32 > ( ) ;
2394
+ }
2375
2395
}
You can’t perform that action at this time.
0 commit comments