forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into merge-queue-fix
- Loading branch information
Showing
5 changed files
with
157 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
fn verify_fma_32() { | ||
let m = 10.0_f32; | ||
let x = 4.0_f32; | ||
let b = 60.0_f32; | ||
|
||
// 100.0 | ||
let abs_difference = (m.mul_add(x, b) - ((m * x) + b)).abs(); | ||
|
||
assert!(abs_difference <= f32::EPSILON); | ||
} | ||
|
||
#[kani::proof] | ||
fn verify_fma_64() { | ||
let m = 10.0_f64; | ||
let x = 4.0_f64; | ||
let b = 60.0_f64; | ||
|
||
// 100.0 | ||
let abs_difference = (m.mul_add(x, b) - ((m * x) + b)).abs(); | ||
|
||
assert!(abs_difference < 1e-10); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
fn verify_sqrt32() { | ||
let positive = 4.0_f32; | ||
let negative_zero = -0.0_f32; | ||
|
||
let abs_difference = (positive.sqrt() - 2.0).abs(); | ||
|
||
assert!(abs_difference <= f32::EPSILON); | ||
assert!(negative_zero.sqrt() == negative_zero); | ||
} | ||
|
||
#[kani::proof] | ||
fn verify_sqrt64() { | ||
let positive = 4.0_f64; | ||
let negative_zero = -0.0_f64; | ||
|
||
let abs_difference = (positive.sqrt() - 2.0).abs(); | ||
|
||
assert!(abs_difference <= 1e-10); | ||
assert!(negative_zero.sqrt() == negative_zero); | ||
} |