aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/Print.cpp
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2012-06-28 23:20:56 -0400
committerDavid A. Mellis <d.mellis@arduino.cc>2012-06-28 23:20:56 -0400
commite77ee2903b276f350e69f12a008088de5a308211 (patch)
treee952677ded53a1b4a9bc9a11f8f4f5b0ba6ed60f /cores/arduino/Print.cpp
parent2ef2f9d5c78ad4a1d265b7386e13c41d41ba410a (diff)
Print "ovf" if float to be printed doesn't fit in a long.
http://code.google.com/p/arduino/issues/detail?id=967
Diffstat (limited to 'cores/arduino/Print.cpp')
-rwxr-xr-xcores/arduino/Print.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 711251c..53961ec 100755
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -228,6 +228,8 @@ size_t Print::printFloat(double number, uint8_t digits)
if (isnan(number)) return print("nan");
if (isinf(number)) return print("inf");
+ if (number > 4294967040.0) return print ("ovf"); // constant determined empirically
+ if (number <-4294967040.0) return print ("ovf"); // constant determined empirically
// Handle negative numbers
if (number < 0.0)