Commit 409bafcc authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Ignore underflows in VarR8FromStr.

parent 61c18632
......@@ -1947,6 +1947,11 @@ static void test_VarNumFromParseNum(void)
/* Currency is preferred over decimal */
SETRGB(0, 1); CONVERT(1,0,0,1,0,0, VTBIT_CY|VTBIT_DECIMAL); EXPECT_CY(1);
/* Underflow test */
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_R4); EXPECT_R4(0.0);
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_R8); EXPECT_R8(0.0);
SETRGB(0, 1); CONVERT(1,0,NUMPRS_EXPONENT,1,0,-94938484, VTBIT_CY); EXPECT_CY(0);
}
......
......@@ -2729,6 +2729,7 @@ static void test_VarR8FromStr(void)
CONVERT_STR(VarR8FromStr,"0.5",LOCALE_NOUSEROVERRIDE); EXPECT(0.5);
CONVERT_STR(VarR8FromStr,"0.6",LOCALE_NOUSEROVERRIDE); EXPECT(0.6);
CONVERT_STR(VarR8FromStr,"1.5",LOCALE_NOUSEROVERRIDE); EXPECT(1.5);
CONVERT_STR(VarR8FromStr,"1e-94938484",LOCALE_NOUSEROVERRIDE); EXPECT(0);
/* We already have exhaustive tests for number parsing, so skip those tests here */
}
......
......@@ -2392,8 +2392,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
{
if (whole < dblMinimums[10] && whole != 0)
{
dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
bOverflow = TRUE;
whole = 0; /* ignore underflow */
divisor10 = 0;
break;
}
whole = whole / dblMultipliers[10];
......@@ -2403,8 +2403,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
{
if (whole < dblMinimums[divisor10] && whole != 0)
{
dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
bOverflow = TRUE;
whole = 0; /* ignore underflow */
divisor10 = 0;
}
else
whole = whole / dblMultipliers[divisor10];
......
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