1
1
// FIXME(f16_f128): only tested on platforms that have symbols and aren't buggy
2
2
#![ cfg( target_has_reliable_f128) ]
3
3
4
+ use core:: ops:: { Add , Div , Mul , Sub } ;
4
5
use std:: f128:: consts;
5
6
use 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 } ;
10
7
11
8
// Note these tolerances make sense around zero, but not for more extreme exponents.
12
9
@@ -49,47 +46,36 @@ fn test_num_f128() {
49
46
assert_biteq ! ( ten. sub( two) , ten - two) ;
50
47
assert_biteq ! ( ten. mul( two) , ten * two) ;
51
48
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) ;
52
51
}
53
52
54
53
// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support
55
54
// the intrinsics.
56
55
57
56
#[ 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) ) ]
69
58
fn test_min_nan ( ) {
70
59
assert_biteq ! ( f128:: NAN . min( 2.0 ) , 2.0 ) ;
71
60
assert_biteq ! ( 2.0f128 . min( f128:: NAN ) , 2.0 ) ;
72
61
}
73
62
74
63
#[ test]
75
- #[ cfg( not( miri) ) ]
76
- #[ cfg( target_has_reliable_f128_math) ]
64
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
77
65
fn test_max_nan ( ) {
78
66
assert_biteq ! ( f128:: NAN . max( 2.0 ) , 2.0 ) ;
79
67
assert_biteq ! ( 2.0f128 . max( f128:: NAN ) , 2.0 ) ;
80
68
}
81
69
82
70
#[ test]
83
- #[ cfg( not( miri) ) ]
84
- #[ cfg( target_has_reliable_f128_math) ]
71
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
85
72
fn test_minimum ( ) {
86
73
assert ! ( f128:: NAN . minimum( 2.0 ) . is_nan( ) ) ;
87
74
assert ! ( 2.0f128 . minimum( f128:: NAN ) . is_nan( ) ) ;
88
75
}
89
76
90
77
#[ test]
91
- #[ cfg( not( miri) ) ]
92
- #[ cfg( target_has_reliable_f128_math) ]
78
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
93
79
fn test_maximum ( ) {
94
80
assert ! ( f128:: NAN . maximum( 2.0 ) . is_nan( ) ) ;
95
81
assert ! ( 2.0f128 . maximum( f128:: NAN ) . is_nan( ) ) ;
@@ -262,7 +248,7 @@ fn test_floor() {
262
248
}
263
249
264
250
#[ test]
265
- #[ cfg( target_has_reliable_f128_math) ]
251
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
266
252
fn test_ceil ( ) {
267
253
assert_biteq ! ( 1.0f128 . ceil( ) , 1.0f128 ) ;
268
254
assert_biteq ! ( 1.3f128 . ceil( ) , 2.0f128 ) ;
@@ -277,7 +263,7 @@ fn test_ceil() {
277
263
}
278
264
279
265
#[ test]
280
- #[ cfg( target_has_reliable_f128_math) ]
266
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
281
267
fn test_round ( ) {
282
268
assert_biteq ! ( 2.5f128 . round( ) , 3.0f128 ) ;
283
269
assert_biteq ! ( 1.0f128 . round( ) , 1.0f128 ) ;
@@ -293,7 +279,7 @@ fn test_round() {
293
279
}
294
280
295
281
#[ test]
296
- #[ cfg( target_has_reliable_f128_math) ]
282
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
297
283
fn test_round_ties_even ( ) {
298
284
assert_biteq ! ( 2.5f128 . round_ties_even( ) , 2.0f128 ) ;
299
285
assert_biteq ! ( 1.0f128 . round_ties_even( ) , 1.0f128 ) ;
@@ -309,7 +295,7 @@ fn test_round_ties_even() {
309
295
}
310
296
311
297
#[ test]
312
- #[ cfg( target_has_reliable_f128_math) ]
298
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
313
299
fn test_trunc ( ) {
314
300
assert_biteq ! ( 1.0f128 . trunc( ) , 1.0f128 ) ;
315
301
assert_biteq ! ( 1.3f128 . trunc( ) , 1.0f128 ) ;
@@ -324,7 +310,7 @@ fn test_trunc() {
324
310
}
325
311
326
312
#[ test]
327
- #[ cfg( target_has_reliable_f128_math) ]
313
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
328
314
fn test_fract ( ) {
329
315
assert_biteq ! ( 1.0f128 . fract( ) , 0.0f128 ) ;
330
316
assert_biteq ! ( 1.3f128 . fract( ) , 0.300000000000000000000000000000000039f128 ) ;
@@ -339,7 +325,7 @@ fn test_fract() {
339
325
}
340
326
341
327
#[ test]
342
- #[ cfg( target_has_reliable_f128_math) ]
328
+ #[ cfg( any ( miri , target_has_reliable_f128_math) ) ]
343
329
fn test_abs ( ) {
344
330
assert_biteq ! ( f128:: INFINITY . abs( ) , f128:: INFINITY ) ;
345
331
assert_biteq ! ( 1 f128. abs( ) , 1 f128) ;
@@ -457,8 +443,7 @@ fn test_mul_add() {
457
443
}
458
444
459
445
#[ test]
460
- #[ cfg( not( miri) ) ]
461
- #[ cfg( target_has_reliable_f128_math) ]
446
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
462
447
fn test_recip ( ) {
463
448
let nan: f128 = f128:: NAN ;
464
449
let inf: f128 = f128:: INFINITY ;
0 commit comments