Commit 0d6c905a authored by Robert Wilhelm's avatar Robert Wilhelm Committed by Alexandre Julliard

oleaut32: Fix VarR8Round for negative numbers.

Floats with fractional part 0.5000 should be rounded to next even number. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55185
parent 56e19e2c
......@@ -2716,6 +2716,13 @@ static void test_VarR8Round(void)
MATHRND(1.4999, 0); EXPECT(1);
MATHRND(1.5000, 0); EXPECT(2);
MATHRND(1.5001, 0); EXPECT(2);
MATHRND(-0.4999, 0); EXPECT(0);
MATHRND(-0.5000, 0); EXPECT(0);
MATHRND(-0.5001, 0); EXPECT(-1);
MATHRND(-1.4999, 0); EXPECT(-1);
MATHRND(-1.5000, 0); EXPECT(-2);
MATHRND(-1.5001, 0); EXPECT(-2);
}
/*
......
......@@ -3379,7 +3379,7 @@ HRESULT WINAPI VarR8Round(double dblIn, int nDig, double *pDblOut)
else if (fract >= 0.0)
dblIn = whole;
else if (fract == -0.5)
dblIn = whole - fmod(whole, 2.0);
dblIn = whole + fmod(whole, 2.0);
else if (fract > -0.5)
dblIn = whole;
else
......
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