diff options
| author | Raoul Strackx <raoul.strackx@fortanix.com> | 2024-11-06 13:41:55 +0100 |
|---|---|---|
| committer | Raoul Strackx <raoul.strackx@fortanix.com> | 2024-11-07 11:33:10 +0100 |
| commit | 072088074e81e8bd945ba7bb26b8ec970ce17172 (patch) | |
| tree | e604d323359f646baca5abc2580f8ed6abf1e696 | |
| parent | 546a1eaab9df8473e9fe8816a51957c7c29332a1 (diff) | |
| download | rust-072088074e81e8bd945ba7bb26b8ec970ce17172.tar.gz rust-072088074e81e8bd945ba7bb26b8ec970ce17172.zip | |
Separate f128 `%` operation to deal with missing `fmodl` symbol
| -rw-r--r-- | library/std/src/f128/tests.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/library/std/src/f128/tests.rs b/library/std/src/f128/tests.rs index 7051c051bf7..cbcf9f96239 100644 --- a/library/std/src/f128/tests.rs +++ b/library/std/src/f128/tests.rs @@ -2,7 +2,10 @@ #![cfg(reliable_f128)] use crate::f128::consts; -use crate::num::{FpCategory as Fp, *}; +use crate::num::FpCategory as Fp; +#[cfg(reliable_f128_math)] +use crate::ops::Rem; +use crate::ops::{Add, Div, Mul, Sub}; // Note these tolerances make sense around zero, but not for more extreme exponents. @@ -53,7 +56,22 @@ macro_rules! assert_f128_biteq { #[test] fn test_num_f128() { - test_num(10f128, 2f128); + // FIXME(f16_f128): replace with a `test_num` call once the required `fmodl`/`fmodf128` + // function is available on all platforms. + let ten = 10f128; + let two = 2f128; + assert_eq!(ten.add(two), ten + two); + assert_eq!(ten.sub(two), ten - two); + assert_eq!(ten.mul(two), ten * two); + assert_eq!(ten.div(two), ten / two); +} + +#[test] +#[cfg(reliable_f128_math)] +fn test_num_f128_rem() { + let ten = 10f128; + let two = 2f128; + assert_eq!(ten.rem(two), ten % two); } #[test] |
