Skip to content

Commit ba89b25

Browse files
committed
Update float_math test to not use constants
1 parent e22d6d5 commit ba89b25

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/test/run-pass/float_math.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@
1212

1313
use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast};
1414

15-
fn main() {
15+
#[inline(never)]
16+
pub fn test_operations(a: f64, b: f64) {
1617
// make sure they all map to the correct operation
1718
unsafe {
18-
assert_eq!(fadd_fast(1., 2.), 1. + 2.);
19-
assert_eq!(fsub_fast(1., 2.), 1. - 2.);
20-
assert_eq!(fmul_fast(2., 3.), 2. * 3.);
21-
assert_eq!(fdiv_fast(10., 5.), 10. / 5.);
22-
assert_eq!(frem_fast(10., 5.), 10. % 5.);
19+
assert_eq!(fadd_fast(a, b), a + b);
20+
assert_eq!(fsub_fast(a, b), a - b);
21+
assert_eq!(fmul_fast(a, b), a * b);
22+
assert_eq!(fdiv_fast(a, b), a / b);
23+
assert_eq!(frem_fast(a, b), a % b);
2324
}
2425
}
26+
27+
fn main() {
28+
test_operations(1., 2.);
29+
test_operations(10., 5.);
30+
}

0 commit comments

Comments
 (0)