Skip to content

Commit 59bc426

Browse files
authored
Merge pull request #23 from r0mai/nans
Identify NANs with isnan()
2 parents c6e840d + 61a3124 commit 59bc426

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

implot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ inline float Remap(float x, float x0, float x1, float y0, float y1) {
104104

105105
/// Turns NANs to 0s
106106
inline float ConstrainNan(float val) {
107-
return val == NAN || val == -NAN ? 0 : val;
107+
return isnan(val) ? 0 : val;
108108
}
109109

110110
/// Turns INFINITYs to FLT_MAXs
@@ -119,7 +119,7 @@ inline float ConstrainLog(float val) {
119119

120120
/// Returns true if val is NAN or INFINITY
121121
inline bool NanOrInf(float val) {
122-
return val == INFINITY || val == NAN || val == -INFINITY || val == -NAN;
122+
return val == INFINITY || val == -INFINITY || isnan(val);
123123
}
124124

125125
/// Utility function to that rounds x to powers of 2,5 and 10 for generating axis labels

0 commit comments

Comments
 (0)