diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-07-17 16:17:09 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-08-01 15:38:53 -0400 |
| commit | e18036c7694df9824a1cd97ce8e1b18be576e569 (patch) | |
| tree | ceb494660fa44e360de798819ec20ac9169da448 /library/std/src/f128/tests.rs | |
| parent | fc43c01417f6351b52d8bd2dc2ba9f9fd3ede14f (diff) | |
| download | rust-e18036c7694df9824a1cd97ce8e1b18be576e569.tar.gz rust-e18036c7694df9824a1cd97ce8e1b18be576e569.zip | |
Add `core` functions for `f16` and `f128` that require math routines
`min`, `max`, and similar functions require external math routines. Add these under the same gates as `std` math functions (`reliable_f16_math` and `reliable_f128_math`).
Diffstat (limited to 'library/std/src/f128/tests.rs')
| -rw-r--r-- | library/std/src/f128/tests.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/library/std/src/f128/tests.rs b/library/std/src/f128/tests.rs index df806a639f6..7051c051bf7 100644 --- a/library/std/src/f128/tests.rs +++ b/library/std/src/f128/tests.rs @@ -56,7 +56,33 @@ fn test_num_f128() { test_num(10f128, 2f128); } -// FIXME(f16_f128): add min and max tests when available +#[test] +#[cfg(reliable_f128_math)] +fn test_min_nan() { + assert_eq!(f128::NAN.min(2.0), 2.0); + assert_eq!(2.0f128.min(f128::NAN), 2.0); +} + +#[test] +#[cfg(reliable_f128_math)] +fn test_max_nan() { + assert_eq!(f128::NAN.max(2.0), 2.0); + assert_eq!(2.0f128.max(f128::NAN), 2.0); +} + +#[test] +#[cfg(reliable_f128_math)] +fn test_minimum() { + assert!(f128::NAN.minimum(2.0).is_nan()); + assert!(2.0f128.minimum(f128::NAN).is_nan()); +} + +#[test] +#[cfg(reliable_f128_math)] +fn test_maximum() { + assert!(f128::NAN.maximum(2.0).is_nan()); + assert!(2.0f128.maximum(f128::NAN).is_nan()); +} #[test] fn test_nan() { |
