11// FIXME(f16_f128): only tested on platforms that have symbols and aren't buggy
22#![ cfg( target_has_reliable_f128) ]
33
4+ use core:: ops:: { Add , Div , Mul , Sub } ;
45use std:: f128:: consts;
56use std:: num:: FpCategory as Fp ;
6- #[ cfg( not( miri) ) ]
7- #[ cfg( target_has_reliable_f128_math) ]
8- use std:: ops:: Rem ;
9- use std:: ops:: { Add , Div , Mul , Sub } ;
107
118// Note these tolerances make sense around zero, but not for more extreme exponents.
129
@@ -49,47 +46,36 @@ fn test_num_f128() {
4946 assert_biteq ! ( ten. sub( two) , ten - two) ;
5047 assert_biteq ! ( ten. mul( two) , ten * two) ;
5148 assert_biteq ! ( ten. div( two) , ten / two) ;
49+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
50+ assert_biteq ! ( core:: ops:: Rem :: rem( ten, two) , ten % two) ;
5251}
5352
5453// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support
5554// the intrinsics.
5655
5756#[ test]
58- #[ cfg( not( miri) ) ]
59- #[ cfg( target_has_reliable_f128_math) ]
60- fn test_num_f128_rem ( ) {
61- let ten = 10 f128;
62- let two = 2 f128;
63- assert_biteq ! ( ten. rem( two) , ten % two) ;
64- }
65-
66- #[ test]
67- #[ cfg( not( miri) ) ]
68- #[ cfg( target_has_reliable_f128_math) ]
57+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
6958fn test_min_nan ( ) {
7059 assert_biteq ! ( f128:: NAN . min( 2.0 ) , 2.0 ) ;
7160 assert_biteq ! ( 2.0f128 . min( f128:: NAN ) , 2.0 ) ;
7261}
7362
7463#[ test]
75- #[ cfg( not( miri) ) ]
76- #[ cfg( target_has_reliable_f128_math) ]
64+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
7765fn test_max_nan ( ) {
7866 assert_biteq ! ( f128:: NAN . max( 2.0 ) , 2.0 ) ;
7967 assert_biteq ! ( 2.0f128 . max( f128:: NAN ) , 2.0 ) ;
8068}
8169
8270#[ test]
83- #[ cfg( not( miri) ) ]
84- #[ cfg( target_has_reliable_f128_math) ]
71+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
8572fn test_minimum ( ) {
8673 assert ! ( f128:: NAN . minimum( 2.0 ) . is_nan( ) ) ;
8774 assert ! ( 2.0f128 . minimum( f128:: NAN ) . is_nan( ) ) ;
8875}
8976
9077#[ test]
91- #[ cfg( not( miri) ) ]
92- #[ cfg( target_has_reliable_f128_math) ]
78+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
9379fn test_maximum ( ) {
9480 assert ! ( f128:: NAN . maximum( 2.0 ) . is_nan( ) ) ;
9581 assert ! ( 2.0f128 . maximum( f128:: NAN ) . is_nan( ) ) ;
@@ -262,7 +248,7 @@ fn test_floor() {
262248}
263249
264250#[ test]
265- #[ cfg( target_has_reliable_f128_math) ]
251+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
266252fn test_ceil ( ) {
267253 assert_biteq ! ( 1.0f128 . ceil( ) , 1.0f128 ) ;
268254 assert_biteq ! ( 1.3f128 . ceil( ) , 2.0f128 ) ;
@@ -277,7 +263,7 @@ fn test_ceil() {
277263}
278264
279265#[ test]
280- #[ cfg( target_has_reliable_f128_math) ]
266+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
281267fn test_round ( ) {
282268 assert_biteq ! ( 2.5f128 . round( ) , 3.0f128 ) ;
283269 assert_biteq ! ( 1.0f128 . round( ) , 1.0f128 ) ;
@@ -293,7 +279,7 @@ fn test_round() {
293279}
294280
295281#[ test]
296- #[ cfg( target_has_reliable_f128_math) ]
282+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
297283fn test_round_ties_even ( ) {
298284 assert_biteq ! ( 2.5f128 . round_ties_even( ) , 2.0f128 ) ;
299285 assert_biteq ! ( 1.0f128 . round_ties_even( ) , 1.0f128 ) ;
@@ -309,7 +295,7 @@ fn test_round_ties_even() {
309295}
310296
311297#[ test]
312- #[ cfg( target_has_reliable_f128_math) ]
298+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
313299fn test_trunc ( ) {
314300 assert_biteq ! ( 1.0f128 . trunc( ) , 1.0f128 ) ;
315301 assert_biteq ! ( 1.3f128 . trunc( ) , 1.0f128 ) ;
@@ -324,7 +310,7 @@ fn test_trunc() {
324310}
325311
326312#[ test]
327- #[ cfg( target_has_reliable_f128_math) ]
313+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
328314fn test_fract ( ) {
329315 assert_biteq ! ( 1.0f128 . fract( ) , 0.0f128 ) ;
330316 assert_biteq ! ( 1.3f128 . fract( ) , 0.300000000000000000000000000000000039f128 ) ;
@@ -339,7 +325,7 @@ fn test_fract() {
339325}
340326
341327#[ test]
342- #[ cfg( target_has_reliable_f128_math) ]
328+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
343329fn test_abs ( ) {
344330 assert_biteq ! ( f128:: INFINITY . abs( ) , f128:: INFINITY ) ;
345331 assert_biteq ! ( 1 f128. abs( ) , 1 f128) ;
@@ -457,8 +443,7 @@ fn test_mul_add() {
457443}
458444
459445#[ test]
460- #[ cfg( not( miri) ) ]
461- #[ cfg( target_has_reliable_f128_math) ]
446+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
462447fn test_recip ( ) {
463448 let nan: f128 = f128:: NAN ;
464449 let inf: f128 = f128:: INFINITY ;
0 commit comments