Skip to content

Commit ab5a73a

Browse files
committed
Mark float intrinsics with no preconditions as safe
1 parent 737dd6c commit ab5a73a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/pass/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,12 +1401,12 @@ fn test_fmuladd() {
14011401

14021402
#[inline(never)]
14031403
pub fn test_operations_f32(a: f32, b: f32, c: f32) {
1404-
assert_approx_eq!(unsafe { fmuladdf32(a, b, c) }, a * b + c);
1404+
assert_approx_eq!(fmuladdf32(a, b, c), a * b + c);
14051405
}
14061406

14071407
#[inline(never)]
14081408
pub fn test_operations_f64(a: f64, b: f64, c: f64) {
1409-
assert_approx_eq!(unsafe { fmuladdf64(a, b, c) }, a * b + c);
1409+
assert_approx_eq!(fmuladdf64(a, b, c), a * b + c);
14101410
}
14111411

14121412
test_operations_f32(0.1, 0.2, 0.3);

tests/pass/intrinsics/fmuladd_nondeterministic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
let c = std::hint::black_box(-a * b);
2929
// It is unspecified whether the following operation is fused or not. The
3030
// following evaluates to 0.0 if unfused, and nonzero (-1.66e-18) if fused.
31-
let x = unsafe { fmuladdf64(a, b, c) };
31+
let x = fmuladdf64(a, b, c);
3232
x == 0.0
3333
}),
3434
"`fmuladdf64` failed to be evaluated as both fused and unfused"
@@ -41,7 +41,7 @@ fn main() {
4141
let c = std::hint::black_box(-a * b);
4242
// It is unspecified whether the following operation is fused or not. The
4343
// following evaluates to 0.0 if unfused, and nonzero (-8.1956386e-10) if fused.
44-
let x = unsafe { fmuladdf32(a, b, c) };
44+
let x = fmuladdf32(a, b, c);
4545
x == 0.0
4646
}),
4747
"`fmuladdf32` failed to be evaluated as both fused and unfused"

0 commit comments

Comments
 (0)