msvcrt: Improved _atoflt_l precision.

This commit is contained in:
Piotr Caban 2012-11-06 10:33:20 +01:00 committed by Alexandre Julliard
parent ffd5e3eb81
commit a3035679d5
2 changed files with 4 additions and 3 deletions

View File

@ -983,6 +983,7 @@ int pf_printf_w(puts_clbk_w, void*, const MSVCRT_wchar_t*, MSVCRT__locale_t,
BOOL, BOOL, args_clbk, void*, __ms_va_list*) DECLSPEC_HIDDEN;
printf_arg arg_clbk_valist(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN;
#define MSVCRT_FLT_MIN 1.175494351e-38F
#define MSVCRT__OVERFLOW 3
#define MSVCRT__UNDERFLOW 4

View File

@ -514,13 +514,13 @@ int CDECL MSVCRT__atoflt_l( MSVCRT__CRT_FLOAT *value, char *str, MSVCRT__locale_
|MSVCRT__EM_OVERFLOW|MSVCRT__EM_UNDERFLOW|MSVCRT__EM_INEXACT, 0xffffffff);
if(exp>0)
value->f = (float)sign*d*powf(10, exp);
value->f = (double)sign*d*pow(10, exp);
else
value->f = (float)sign*d/powf(10, -exp);
value->f = (double)sign*d/pow(10, -exp);
_control87(fpcontrol, 0xffffffff);
if((d && value->f==0.0) || isinf(value->f))
if((d && value->f>-MSVCRT_FLT_MIN && value->f<MSVCRT_FLT_MIN) || isinf(value->f))
ret = exp > 0 ? MSVCRT__OVERFLOW : MSVCRT__UNDERFLOW;
return ret;