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 branch 'main' into merge-queue
- Loading branch information
Showing
7 changed files
with
80 additions
and
39 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
3 changes: 0 additions & 3 deletions
3
.../cast_abstract_args_to_concrete_fixme2.rs → ...ni/Cast/cast_abstract_args_to_concrete.rs
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 was deleted.
Oops, something went wrong.
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,23 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
fn verify_log10_32() { | ||
let ten = 10.0f32; | ||
|
||
// log10(10) - 1 == 0 | ||
let abs_difference = (ten.log10() - 1.0).abs(); | ||
|
||
// should be <= f32::EPSILON, but CBMC's approximation of log10 makes results less precise | ||
assert!(abs_difference <= 0.03); | ||
} | ||
|
||
#[kani::proof] | ||
fn verify_log10_64() { | ||
let hundred = 100.0_f64; | ||
|
||
// log10(100) - 2 == 0 | ||
let abs_difference = (hundred.log10() - 2.0).abs(); | ||
|
||
assert!(abs_difference < 0.03); | ||
} |
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,23 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
fn verify_log2_32() { | ||
let two = 2.0f32; | ||
|
||
// log2(2) - 1 == 0 | ||
let abs_difference = (two.log2() - 1.0).abs(); | ||
|
||
// should be <= f32::EPSILON, but CBMC's approximation of log2 makes results less precise | ||
assert!(abs_difference <= 0.09); | ||
} | ||
|
||
#[kani::proof] | ||
fn verify_log2_64() { | ||
let four = 4.0_f64; | ||
|
||
// log2(4) - 2 == 0 | ||
let abs_difference = (four.log2() - 2.0).abs(); | ||
|
||
assert!(abs_difference < 0.09); | ||
} |
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,22 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
#[kani::proof] | ||
fn verify_powi32() { | ||
let x: f32 = kani::any(); | ||
kani::assume(x.is_normal()); | ||
kani::assume(x >= 1e-19 || x <= -1e-19); | ||
kani::assume(x <= 1.84e19 && x >= -1.84e19); | ||
let x2 = x.powi(2); | ||
assert!(x2 >= 0.0); | ||
} | ||
|
||
#[kani::proof] | ||
fn verify_powi64() { | ||
let x: f64 = kani::any(); | ||
kani::assume(x.is_normal()); | ||
kani::assume(x >= 1e-153 || x <= -1e-153); | ||
kani::assume(x <= 1.34e154 && x >= -1.34e154); | ||
let x2 = x.powi(2); | ||
assert!(x2 >= 0.0); | ||
} |