aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cores/arduino/WString.cpp9
-rw-r--r--cores/arduino/WString.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index 9975303..998cf22 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -740,6 +740,11 @@ long String::toInt(void) const
float String::toFloat(void) const
{
- if (buffer) return float(atof(buffer));
- return 0;
+ return float(toDouble());
}
+
+double String::toDouble(void) const
+{
+ if (buffer) return atof(buffer);
+ return 0;
+} \ No newline at end of file
diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h
index de5632c..08b8147 100644
--- a/cores/arduino/WString.h
+++ b/cores/arduino/WString.h
@@ -190,6 +190,7 @@ public:
// parsing/conversion
long toInt(void) const;
float toFloat(void) const;
+ double toDouble(void) const;
protected:
char *buffer; // the actual char array