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_eq ! ( ten. sub( two) , ten - two) ;
50
47
assert_eq ! ( ten. mul( two) , ten * two) ;
51
48
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) ;
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_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) ) ]
69
58
fn test_min_nan ( ) {
70
59
assert_eq ! ( f128:: NAN . min( 2.0 ) , 2.0 ) ;
71
60
assert_eq ! ( 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_eq ! ( f128:: NAN . max( 2.0 ) , 2.0 ) ;
79
67
assert_eq ! ( 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( ) ) ;
@@ -246,7 +232,6 @@ fn test_classify() {
246
232
}
247
233
248
234
#[ test]
249
- #[ cfg( not( miri) ) ]
250
235
#[ cfg( target_has_reliable_f128_math) ]
251
236
fn test_floor ( ) {
252
237
assert_eq ! ( 1.0f128 . floor( ) , 1.0f128 ) ;
@@ -262,8 +247,7 @@ fn test_floor() {
262
247
}
263
248
264
249
#[ test]
265
- #[ cfg( not( miri) ) ]
266
- #[ cfg( target_has_reliable_f128_math) ]
250
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
267
251
fn test_ceil ( ) {
268
252
assert_eq ! ( 1.0f128 . ceil( ) , 1.0f128 ) ;
269
253
assert_eq ! ( 1.3f128 . ceil( ) , 2.0f128 ) ;
@@ -278,8 +262,7 @@ fn test_ceil() {
278
262
}
279
263
280
264
#[ test]
281
- #[ cfg( not( miri) ) ]
282
- #[ cfg( target_has_reliable_f128_math) ]
265
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
283
266
fn test_round ( ) {
284
267
assert_eq ! ( 2.5f128 . round( ) , 3.0f128 ) ;
285
268
assert_eq ! ( 1.0f128 . round( ) , 1.0f128 ) ;
@@ -295,8 +278,7 @@ fn test_round() {
295
278
}
296
279
297
280
#[ test]
298
- #[ cfg( not( miri) ) ]
299
- #[ cfg( target_has_reliable_f128_math) ]
281
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
300
282
fn test_round_ties_even ( ) {
301
283
assert_eq ! ( 2.5f128 . round_ties_even( ) , 2.0f128 ) ;
302
284
assert_eq ! ( 1.0f128 . round_ties_even( ) , 1.0f128 ) ;
@@ -312,8 +294,7 @@ fn test_round_ties_even() {
312
294
}
313
295
314
296
#[ test]
315
- #[ cfg( not( miri) ) ]
316
- #[ cfg( target_has_reliable_f128_math) ]
297
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
317
298
fn test_trunc ( ) {
318
299
assert_eq ! ( 1.0f128 . trunc( ) , 1.0f128 ) ;
319
300
assert_eq ! ( 1.3f128 . trunc( ) , 1.0f128 ) ;
@@ -328,8 +309,7 @@ fn test_trunc() {
328
309
}
329
310
330
311
#[ test]
331
- #[ cfg( not( miri) ) ]
332
- #[ cfg( target_has_reliable_f128_math) ]
312
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
333
313
fn test_fract ( ) {
334
314
assert_eq ! ( 1.0f128 . fract( ) , 0.0f128 ) ;
335
315
assert_eq ! ( 1.3f128 . fract( ) , 0.300000000000000000000000000000000039f128 ) ;
@@ -344,8 +324,7 @@ fn test_fract() {
344
324
}
345
325
346
326
#[ test]
347
- #[ cfg( not( miri) ) ]
348
- #[ cfg( target_has_reliable_f128_math) ]
327
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
349
328
fn test_abs ( ) {
350
329
assert_eq ! ( f128:: INFINITY . abs( ) , f128:: INFINITY ) ;
351
330
assert_eq ! ( 1 f128. abs( ) , 1 f128) ;
@@ -463,8 +442,7 @@ fn test_mul_add() {
463
442
}
464
443
465
444
#[ test]
466
- #[ cfg( not( miri) ) ]
467
- #[ cfg( target_has_reliable_f128_math) ]
445
+ #[ cfg( any( miri, target_has_reliable_f128_math) ) ]
468
446
fn test_recip ( ) {
469
447
let nan: f128 = f128:: NAN ;
470
448
let inf: f128 = f128:: INFINITY ;
0 commit comments