Skip to content

Commit 502bbec

Browse files
committed
avoid ambiguous use of isnan/isinf
1 parent e7c322d commit 502bbec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp/arduino/WString.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class String: public string
4141

4242
static string dtoas(double val, int decimalPlaces) {
4343
double r = 0.5 * pow(0.1, decimalPlaces); // make sure that integer truncation will properly round
44+
if (::isnan(val)) return "nan";
45+
if (::isinf(val)) return "inf";
4446
val += val > 0 ? r : -r;
45-
if (isnan(val)) return "nan";
46-
if (isinf(val)) return "inf";
4747
if (val > 4294967040.0) return "ovf";
4848
if (val <-4294967040.0) return "ovf";
4949
return mytoas(val, 10) + "." + mytoa(abs(val - (long)val) * pow(10, decimalPlaces), 10);

0 commit comments

Comments
 (0)