-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented in CBMC in diffblue/cbmc#8195. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. Co-authored-by: Felipe R. Monteiro <[email protected]>
- Loading branch information
1 parent
24fc8aa
commit 343ed8c
Showing
3 changed files
with
30 additions
and
4 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
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); | ||
} |