We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faff175 commit e5e0cedCopy full SHA for e5e0ced
tests/run-pass/float_fast_math.rs
@@ -3,7 +3,19 @@
3
use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast};
4
5
#[inline(never)]
6
-pub fn test_operations(a: f64, b: f64) {
+pub fn test_operations_f64(a: f64, b: f64) {
7
+ // make sure they all map to the correct operation
8
+ unsafe {
9
+ assert_eq!(fadd_fast(a, b), a + b);
10
+ assert_eq!(fsub_fast(a, b), a - b);
11
+ assert_eq!(fmul_fast(a, b), a * b);
12
+ assert_eq!(fdiv_fast(a, b), a / b);
13
+ assert_eq!(frem_fast(a, b), a % b);
14
+ }
15
+}
16
+
17
+#[inline(never)]
18
+pub fn test_operations_f32(a: f32, b: f32) {
19
// make sure they all map to the correct operation
20
unsafe {
21
assert_eq!(fadd_fast(a, b), a + b);
@@ -15,6 +27,8 @@ pub fn test_operations(a: f64, b: f64) {
27
}
28
29
fn main() {
- test_operations(1., 2.);
- test_operations(10., 5.);
30
+ test_operations_f64(1., 2.);
31
+ test_operations_f64(10., 5.);
32
+ test_operations_f32(11., 2.);
33
+ test_operations_f32(10., 15.);
34
0 commit comments