Skip to content

Commit 1c21304

Browse files
committed
Separate f128 % operation to deal with missing fmodl symbol
1 parent 546a1ea commit 1c21304

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

library/std/src/f128/tests.rs

+17-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#![cfg(reliable_f128)]
33

44
use crate::f128::consts;
5-
use crate::num::{FpCategory as Fp, *};
5+
use crate::num::FpCategory as Fp;
6+
use crate::ops::{Add, Div, Mul, Rem, Sub};
67

78
// Note these tolerances make sense around zero, but not for more extreme exponents.
89

@@ -53,7 +54,21 @@ macro_rules! assert_f128_biteq {
5354

5455
#[test]
5556
fn test_num_f128() {
56-
test_num(10f128, 2f128);
57+
// FIXME(f16_f128): replace with a `test_num` call once the required `fmodl`/`fmodf128` function is available on all platforms.
58+
let ten = 10f128;
59+
let two = 2f128;
60+
assert_eq!(ten.add(two), ten + two);
61+
assert_eq!(ten.sub(two), ten - two);
62+
assert_eq!(ten.mul(two), ten * two);
63+
assert_eq!(ten.div(two), ten / two);
64+
}
65+
66+
#[test]
67+
#[cfg(reliable_f128_math)]
68+
fn test_num_f128_rem() {
69+
let ten = 10f128;
70+
let two = 2f128;
71+
assert_eq!(ten.rem(two), ten % two);
5772
}
5873

5974
#[test]

0 commit comments

Comments
 (0)