http://bugs.winehq.org/show_bug.cgi?id=30485
gluk1024@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gluk1024@gmail.com
--- Comment #7 from gluk1024@gmail.com 2012-09-28 07:31:35 CDT --- Used to step on that bug too. I've needed a fast fix, so wrote the implementation myself. Here is the realisation for that function, that worked for me:
HRESULT WINAPI VarDecRound(const DECIMAL* pDecIn, int cDecimals, DECIMAL* pDecOut) { if (cDecimals < 0 || (DEC_SIGN(pDecIn) & ~DECIMAL_NEG) || DEC_SCALE(pDecIn) > DEC_MAX_SCALE) return E_INVALIDARG;
if (cDecimals >= DEC_SCALE(pDecIn)) { *pDecOut = *pDecIn; /* More precision than we have */ return S_OK; } else { double dbResult; HRESULT hRet;
hRet = VarR8FromDec(pDecIn, &dbResult); if (SUCCEEDED(hRet)) { dbResult = floor(dbResult * pow(10, cDecimals) + 0.5) / pow(10, cDecimals); hRet = VarDecFromR8(dbResult, pDecOut); if (SUCCEEDED(hRet)) { return S_OK; } } }
FIXME("semi-stub!\n");
return DISP_E_OVERFLOW; }