Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@rescript/runtime/Stdlib_Float.res
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ external equal: (float, float) => bool = "%equal"

external compare: (float, float) => Stdlib_Ordering.t = "%compare"

@val external isNaN: float => bool = "isNaN"
@val @scope("Number") external isNaN: float => bool = "isNaN"
@val external isFinite: float => bool = "isFinite"
@val external parseFloat: 'a => float = "parseFloat"
// parseInt's return type is a float because it can be NaN
Expand Down
4 changes: 2 additions & 2 deletions packages/@rescript/runtime/Stdlib_Float.resi
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ external compare: (float, float) => Stdlib_Ordering.t = "%compare"

/**
`isNaN(v)` tests if the given `v` is `NaN`.
See [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.
See [`isNaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) on MDN.

## Examples

Expand All @@ -148,7 +148,7 @@ Float.isNaN(3.0) // false
Float.isNaN(Float.Constants.nan) // true
```
*/
@val
@val @scope("Number")
external isNaN: float => bool = "isNaN"

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@rescript/runtime/lib/es6/Stdlib_Float.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let Constants = {};

function fromString(i) {
let i$1 = parseFloat(i);
if (isNaN(i$1)) {
if (Number.isNaN(i$1)) {
return;
} else {
return i$1;
Expand Down
2 changes: 1 addition & 1 deletion packages/@rescript/runtime/lib/es6/Stdlib_Int.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Stdlib_Array from "./Stdlib_Array.js";

function fromString(x, radix) {
let maybeInt = radix !== undefined ? parseInt(x, radix) : parseInt(x);
if (isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
if (Number.isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
return;
} else {
return maybeInt | 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/@rescript/runtime/lib/js/Stdlib_Float.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let Constants = {};

function fromString(i) {
let i$1 = parseFloat(i);
if (isNaN(i$1)) {
if (Number.isNaN(i$1)) {
return;
} else {
return i$1;
Expand Down
2 changes: 1 addition & 1 deletion packages/@rescript/runtime/lib/js/Stdlib_Int.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let Stdlib_Array = require("./Stdlib_Array.js");

function fromString(x, radix) {
let maybeInt = radix !== undefined ? parseInt(x, radix) : parseInt(x);
if (isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
if (Number.isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
return;
} else {
return maybeInt | 0;
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/src/core/Core_FloatTests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Test.run([
33
],
"clamp - nan"
], isNaN(Stdlib_Float.clamp(4.1, 4.3, Number.NaN)), eq, true);
], Number.isNaN(Stdlib_Float.clamp(4.1, 4.3, Number.NaN)), eq, true);

Test.run([
[
Expand Down
Loading