See this thread:
https://forums.garmin.com/developer/connect-iq/f/discussion/338071/testing-for-nan/1637852#1637852
The following code snippet works
var rad = NaN;System.println("rad == NaN: " + (rad == NaN)); // falseSystem.println("rad.equals(NaN): " + rad.equals(NaN)); // true
It returns
rad == NaN:false
rad.equals(NaN): true
The following code snippet does NOT work
var rad = Math.acos(45);System.println("rad == NaN: " + (rad == NaN)); // falseSystem.println("rad.equals(NaN): " + rad.equals(NaN)); // true
It returns
rad == NaN:false
rad.equals(NaN): false
In both cases, rad is NaN (Lang.Float) but in the bottom one, both line returns 'false'. How can one check for NaN returned from a Math function???
Running CIQ 4.2.4.
-
flowstate
-
Cancel
-
Vote Up
+1
Vote Down
-
-
More
-
Cancel
Comment-
flowstate
-
Cancel
-
Vote Up
+1
Vote Down
-
-
More
-
Cancel
Children