Commit 80dfd005 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

oleaut32: Strip trailing decimal zeroes when rounding a number in VarFormat.

parent d1de5f37
......@@ -380,6 +380,7 @@ static void test_VarFormat(void)
VARFMT(VT_R8,V_R8,-1.57,"#.##",S_OK,"-1.57");
VARFMT(VT_R8,V_R8,-0.1,".#",S_OK,"-.1");
VARFMT(VT_R8,V_R8,0.099,"#.#",S_OK,".1");
VARFMT(VT_R8,V_R8,0.0999,"#.##",S_OK,".1");
/* 'out' is not cleared */
......
......@@ -1313,6 +1313,9 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
}
else
(*prgbDig)++;
/* We converted trailing digits to zeroes => have_frac has changed */
while (have_frac > 0 && rgbDig[have_int + have_frac - 1] == 0)
have_frac--;
}
}
TRACE("have_int=%d,need_int=%d,have_frac=%d,need_frac=%d,pad=%d,exp=%d\n",
......
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