File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2362,6 +2362,7 @@ mod tests {
23622362 assert ! ( p. is_sign_positive( ) ) ;
23632363 assert ! ( n. is_sign_negative( ) ) ;
23642364 assert ! ( nan. is_nan( ) ) ;
2365+ assert ! ( !nan. is_subnormal( ) ) ;
23652366
23662367 assert_eq ! ( p, p. copysign( p) ) ;
23672368 assert_eq ! ( p. neg( ) , p. copysign( n) ) ;
@@ -2372,4 +2373,23 @@ mod tests {
23722373 assert ! ( nan. copysign( p) . is_sign_positive( ) ) ;
23732374 assert ! ( nan. copysign( n) . is_sign_negative( ) ) ;
23742375 }
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+ }
23752395}
You can’t perform that action at this time.
0 commit comments