-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CBMC's sqrt* implementations were fixed in diffblue/cbmc#8195.
- Loading branch information
1 parent
beccc4c
commit 4a92557
Showing
3 changed files
with
28 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,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); | ||
} |