Skip to content

Commit 0e0fce8

Browse files
Fix: Fix(vm): Evaluate range guard before f64 -> i64 cast in display to prevent saturation false positive.
1 parent 33bffc4 commit 0e0fce8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/modules/vm/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'a> VM<'a> {
7272
if v.is_float() {
7373
let f = v.as_float();
7474
const I64_UPPER: f64 = i64::MAX as f64;
75-
if f.is_finite() && f == f.trunc() && f >= (i64::MIN as f64) && f < I64_UPPER {
75+
if f.is_finite() && f >= (i64::MIN as f64) && f < I64_UPPER && f == (f as i64) as f64 {
7676
let i = f as i64;
7777
let mut b = itoa::Buffer::new();
7878
if i > Val::INT_MAX || i < Val::INT_MIN {

0 commit comments

Comments
 (0)