on master help sign in
Merge branch 'pr/528' into dev
804d895Evan Czaplicki
libraries/Basics.elm+14
@@ -30,6 +30,9 @@ are your tuples so big?
30# Number Conversions
30# Number Conversions
31@docs round, floor, ceiling, truncate, toFloat
31@docs round, floor, ceiling, truncate, toFloat
32
32
33+# Floating Point Checks
34+@docs isNaN, isFinite
35+
33# Angle Conversions
36# Angle Conversions
34All angle conversions result in “standard Elm angles”
37All angle conversions result in “standard Elm angles”
35which happen to be radians.
38which happen to be radians.
@@ -271,6 +274,17 @@ ceiling = Native.Basics.ceiling
271toFloat : Int -> Float
274toFloat : Int -> Float
272toFloat = Native.Basics.toFloat
275toFloat = Native.Basics.toFloat
273
276
277+{- | Determines whether a float is an undefined or unrepresentable number,
278+such as 0/0. NaN stands for *not a number*.
279+-}
280+isNaN : Float -> Bool
281+isNaN = Native.Basics.isNaN
282+
283+{- | Determines whether a float is finite. Positive and negative infinity are
284+valid floating point numbers, created by computations like `1/0` and `-1/0`.
285+-}
286+isFinite : Float -> Bool
287+isFinite = Native.Basics.isFinite
274
288
275-- Function Helpers
289-- Function Helpers
276
290
libraries/Native/Basics.js+2
@@ -53,6 +53,8 @@ Elm.Native.Basics.make = function(elm) {
53 floor:Math.floor,
53 floor:Math.floor,
54 round:Math.round,
54 round:Math.round,
55 toFloat:function(x) { return x; },
55 toFloat:function(x) { return x; },
56+ isNaN:isNaN,
57+ isFinite:isFinite
56 };
58 };
57
59
58 return elm.Native.Basics.values = basics;
60 return elm.Native.Basics.values = basics;