1. Bryan O'Sullivan
  2. double-conversion

Source

double-conversion / src / double-conversion.h

The branch 'single' does not exist.
Diff from to

File src/double-conversion.h

  • Ignore whitespace
   // in the 'processed_characters_count'. Trailing junk is never included.
   double StringToDouble(const char* buffer,
                         int length,
-                        int* processed_characters_count);
+                        int* processed_characters_count) {
+    return StringToIeee(buffer, length, processed_characters_count, true);
+  }
+
+  // Same as StringToDouble but reads a float.
+  // Note that this is not equivalent to static_cast<float>(StringToDouble(...))
+  // due to potential double-rounding.
+  float StringToFloat(const char* buffer,
+                      int length,
+                      int* processed_characters_count) {
+    return static_cast<float>(StringToIeee(buffer, length,
+                                           processed_characters_count, false));
+  }
 
  private:
   const int flags_;
   const char* const infinity_symbol_;
   const char* const nan_symbol_;
 
+  double StringToIeee(const char* buffer,
+                      int length,
+                      int* processed_characters_count,
+                      bool read_as_double);
+
   DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
 };