Skip to content

Commit 58e1533

Browse files
committed
Fix clippy lint for float_is_integer
1 parent f364ea5 commit 58e1533

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

vm/src/obj/objfloat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn float_real(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
417417
fn float_is_integer(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
418418
arg_check!(vm, args, required = [(i, Some(vm.ctx.float_type()))]);
419419
let v = get_value(i);
420-
let result = v == v.round();
420+
let result = (v - v.round()).abs() < std::f64::EPSILON;
421421
Ok(vm.ctx.new_bool(result))
422422
}
423423

0 commit comments

Comments
 (0)