57 static const double pow10_[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
58 10000000, 100000000, 1000000000};
64 aux = *end, *end-- = *begin, *begin++ = aux;
71 const double thres_max = (double)(0x7FFFFFFF);
85 if (! (value == value)) {
86 str[0] =
'n'; str[1] =
'a'; str[2] =
'n'; str[3] =
'\0';
92 }
else if (prec > 9) {
106 tmp = (value - whole) *
pow10_[prec];
107 frac = (uint32_t)(tmp);
113 if (frac >=
pow10_[prec]) {
117 }
else if (diff == 0.5 && ((frac == 0) || (frac & 1))) {
129 if (value > thres_max)
130 return sprintf(str,
"%e", neg ? -value : value);
133 diff = value - whole;
137 }
else if (diff == 0.5 && (whole & 1)) {
143 int count = prec, done = 0;
149 done += (*wstr++ = (char)(48 + (frac % 10)));
168 *wstr++ = (char)(48 + (whole % 10));
static void strreverse(char *begin, char *end)
static const double pow10_[]
F8API size_t modp_dtoa(double value, char *str, int prec)
Convert double to ascii.