Skip to content

Commit 362956f

Browse files
committed
Let Infinity pass the is_float test
1 parent f3fcb74 commit 362956f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

functions/var/is_float.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ function is_float (mixed_var) {
99
// * example 1: is_float(186.31);
1010
// * returns 1: true
1111

12-
return +mixed_var === mixed_var && !!(mixed_var % 1);
12+
return +mixed_var === mixed_var && (!isFinite(mixed_var) || !!(mixed_var % 1));
1313
}

0 commit comments

Comments
 (0)