diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/compiler_builtins/libm/src/math/sqrtf.rs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/compiler_builtins/libm/src/math/sqrtf.rs')
-rw-r--r-- | vendor/compiler_builtins/libm/src/math/sqrtf.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/compiler_builtins/libm/src/math/sqrtf.rs b/vendor/compiler_builtins/libm/src/math/sqrtf.rs index 00b20e578..8ec72fbf7 100644 --- a/vendor/compiler_builtins/libm/src/math/sqrtf.rs +++ b/vendor/compiler_builtins/libm/src/math/sqrtf.rs @@ -151,4 +151,20 @@ mod tests { assert_eq!(sqrtf(f), f); } } + + #[test] + fn conformance_tests() { + let values = [ + 3.14159265359f32, + 10000.0f32, + f32::from_bits(0x0000000f), + INFINITY, + ]; + let results = [1071833029u32, 1120403456u32, 456082799u32, 2139095040u32]; + + for i in 0..values.len() { + let bits = f32::to_bits(sqrtf(values[i])); + assert_eq!(results[i], bits); + } + } } |