Commit 9a05e1fd authored by Dave Belanger's avatar Dave Belanger Committed by Alexandre Julliard

wcstod: added exponent parsing and fixed handling of negative sign.

parent 70c4864e
......@@ -20,6 +20,7 @@
*/
#include <limits.h>
#include <stdio.h>
#include <math.h>
#include "msvcrt.h"
#include "winnls.h"
#include "wine/unicode.h"
......@@ -150,6 +151,32 @@ double MSVCRT_wcstod(const MSVCRT_wchar_t* lpszStr, MSVCRT_wchar_t** end)
str++;
}
if (*str == 'E' || *str == 'e' || *str == 'D' || *str == 'd')
{
int negativeExponent = 0;
int exponent = 0;
if (*(++str) == '-')
{
negativeExponent = 1;
str++;
}
while (isdigitW(*str))
{
exponent = exponent * 10 + (*str - '0');
str++;
}
if (exponent != 0)
{
if (negativeExponent)
ret = ret / pow(10.0, exponent);
else
ret = ret * pow(10.0, exponent);
}
}
if (negative)
ret = -ret;
if (end)
*end = (MSVCRT_wchar_t*)str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment