Skip to content

Commit f9e2cef

Browse files
authored
Add test for floating point remainder issue (#2679)
1 parent 56c724b commit f9e2cef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Checks that the remainder operator works with floating point values (see issue #2669)
5+
6+
#[kani::proof]
7+
fn rem_float() {
8+
let dividend = 0.5 * f32::from(kani::any::<i8>());
9+
let divisor = 0.5 * f32::from(kani::any::<i8>());
10+
kani::assume(divisor != 0.0);
11+
let result = dividend % divisor;
12+
assert!(result == 0.0 || result.is_normal());
13+
}

0 commit comments

Comments
 (0)