Skip to content

Commit 6036846

Browse files
committed
Print "ovf" if float to be printed doesn't fit in a long.
http://code.google.com/p/arduino/issues/detail?id=967
1 parent 1daeba6 commit 6036846

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hardware/arduino/cores/arduino/Print.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ size_t Print::printFloat(double number, uint8_t digits)
228228

229229
if (isnan(number)) return print("nan");
230230
if (isinf(number)) return print("inf");
231+
if (number > 4294967040.0) return print ("ovf"); // constant determined empirically
232+
if (number <-4294967040.0) return print ("ovf"); // constant determined empirically
231233

232234
// Handle negative numbers
233235
if (number < 0.0)

0 commit comments

Comments
 (0)