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_eq ! ( ten. sub( two) , ten - two) ;
5047 assert_eq ! ( ten. mul( two) , ten * two) ;
5148 assert_eq ! ( ten. div( two) , ten / two) ;
49+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
50+ assert_eq ! ( 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_eq ! ( 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_eq ! ( f128:: NAN . min( 2.0 ) , 2.0 ) ;
7160 assert_eq ! ( 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_eq ! ( f128:: NAN . max( 2.0 ) , 2.0 ) ;
7967 assert_eq ! ( 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( ) ) ;
@@ -246,7 +232,6 @@ fn test_classify() {
246232}
247233
248234#[ test]
249- #[ cfg( not( miri) ) ]
250235#[ cfg( target_has_reliable_f128_math) ]
251236fn test_floor ( ) {
252237 assert_eq ! ( 1.0f128 . floor( ) , 1.0f128 ) ;
@@ -262,8 +247,7 @@ fn test_floor() {
262247}
263248
264249#[ test]
265- #[ cfg( not( miri) ) ]
266- #[ cfg( target_has_reliable_f128_math) ]
250+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
267251fn test_ceil ( ) {
268252 assert_eq ! ( 1.0f128 . ceil( ) , 1.0f128 ) ;
269253 assert_eq ! ( 1.3f128 . ceil( ) , 2.0f128 ) ;
@@ -278,8 +262,7 @@ fn test_ceil() {
278262}
279263
280264#[ test]
281- #[ cfg( not( miri) ) ]
282- #[ cfg( target_has_reliable_f128_math) ]
265+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
283266fn test_round ( ) {
284267 assert_eq ! ( 2.5f128 . round( ) , 3.0f128 ) ;
285268 assert_eq ! ( 1.0f128 . round( ) , 1.0f128 ) ;
@@ -295,8 +278,7 @@ fn test_round() {
295278}
296279
297280#[ test]
298- #[ cfg( not( miri) ) ]
299- #[ cfg( target_has_reliable_f128_math) ]
281+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
300282fn test_round_ties_even ( ) {
301283 assert_eq ! ( 2.5f128 . round_ties_even( ) , 2.0f128 ) ;
302284 assert_eq ! ( 1.0f128 . round_ties_even( ) , 1.0f128 ) ;
@@ -312,8 +294,7 @@ fn test_round_ties_even() {
312294}
313295
314296#[ test]
315- #[ cfg( not( miri) ) ]
316- #[ cfg( target_has_reliable_f128_math) ]
297+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
317298fn test_trunc ( ) {
318299 assert_eq ! ( 1.0f128 . trunc( ) , 1.0f128 ) ;
319300 assert_eq ! ( 1.3f128 . trunc( ) , 1.0f128 ) ;
@@ -328,8 +309,7 @@ fn test_trunc() {
328309}
329310
330311#[ test]
331- #[ cfg( not( miri) ) ]
332- #[ cfg( target_has_reliable_f128_math) ]
312+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
333313fn test_fract ( ) {
334314 assert_eq ! ( 1.0f128 . fract( ) , 0.0f128 ) ;
335315 assert_eq ! ( 1.3f128 . fract( ) , 0.300000000000000000000000000000000039f128 ) ;
@@ -344,8 +324,7 @@ fn test_fract() {
344324}
345325
346326#[ test]
347- #[ cfg( not( miri) ) ]
348- #[ cfg( target_has_reliable_f128_math) ]
327+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
349328fn test_abs ( ) {
350329 assert_eq ! ( f128:: INFINITY . abs( ) , f128:: INFINITY ) ;
351330 assert_eq ! ( 1 f128. abs( ) , 1 f128) ;
@@ -463,8 +442,7 @@ fn test_mul_add() {
463442}
464443
465444#[ test]
466- #[ cfg( not( miri) ) ]
467- #[ cfg( target_has_reliable_f128_math) ]
445+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
468446fn test_recip ( ) {
469447 let nan: f128 = f128:: NAN ;
470448 let inf: f128 = f128:: INFINITY ;
0 commit comments