]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - wtf/dtoa.h
JavaScriptCore-903.tar.gz
[apple/javascriptcore.git] / wtf / dtoa.h
index 6127f53972a3180bd3b8c03c7ed3768bb9b26338..3924a1cc405db293b01f6d4bdae657595258172c 100644 (file)
 #ifndef WTF_dtoa_h
 #define WTF_dtoa_h
 
-namespace WTF {
-    class Mutex;
-}
+#include <wtf/unicode/Unicode.h>
 
 namespace WTF {
+class Mutex;
+
+extern WTF::Mutex* s_dtoaP5Mutex;
 
-    extern WTF::Mutex* s_dtoaP5Mutex;
+// s00: input string. Must not be 0 and must be terminated by 0.
+// se: *se will have the last consumed character position + 1.
+double strtod(const char* s00, char** se);
 
-    double strtod(const char* s00, char** se);
+typedef char DtoaBuffer[80];
 
-    typedef char DtoaBuffer[80];
-    void dtoa(DtoaBuffer result, double d, int ndigits, int* decpt, int* sign, char** rve);
+void dtoa(DtoaBuffer result, double dd, bool& sign, int& exponent, unsigned& precision);
+void dtoaRoundSF(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
+void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
 
-    // dtoa() for ECMA-262 'ToString Applied to the Number Type.'
-    // The *resultLength will have the length of the resultant string in bufer.
-    // The resultant string isn't terminated by 0.
-    void doubleToStringInJavaScriptFormat(double, DtoaBuffer, unsigned* resultLength);
+// Size = 80 for sizeof(DtoaBuffer) + some sign bits, decimal point, 'e', exponent digits.
+const unsigned NumberToStringBufferLength = 96;
+typedef UChar NumberToStringBuffer[NumberToStringBufferLength];
+unsigned numberToString(double, NumberToStringBuffer);
 
 } // namespace WTF
 
-using WTF::DtoaBuffer;
-using WTF::doubleToStringInJavaScriptFormat;
+using WTF::NumberToStringBuffer;
+using WTF::numberToString;
 
 #endif // WTF_dtoa_h