On Mon, 15 Oct 2007, Gerald Pfeifer wrote:
dlls/oleaut32/tests/vartype.c has the following snippet of code:
- f = -1e-400; /* deliberately cause underflow */
- hres = pVarBstrFromR4(f, lcid, 0, &bstr);
- ok(hres == S_OK, "got hres 0x%08lx\n", hres);
- if (bstr)
- {
- todo_wine ok(memcmp(bstr, szZero, sizeof(szZero)) == 0, "negative zero (got %s)\n", wtoascii(bstr));
- }
which was added in
revision 1.27 Alex VillacĂs Lasso a_villacis@palosanto.com Test for behavior of negative underflow formatting.
This doesn't seem to work as intended, because it is a floating point *constant* which current versions of GCC simply truncate to 0.0.
The following patch tries to address this.
Gerald
ChangeLog: Avoid truncation of floating point calculation at compile-time. Index: dlls/oleaut32/tests/vartype.c =================================================================== RCS file: /home/wine/wine/dlls/oleaut32/tests/vartype.c,v retrieving revision 1.51 diff -u -3 -p -r1.51 vartype.c --- dlls/oleaut32/tests/vartype.c 20 Aug 2007 12:43:49 -0000 1.51 +++ dlls/oleaut32/tests/vartype.c 29 Oct 2007 22:40:24 -0000 @@ -4727,6 +4727,7 @@ static void test_VarBstrFromR4(void) HRESULT hres; BSTR bstr = NULL;
+ const float flarge=1e20; float f;
CHECKPTR(VarBstrFromR4); @@ -4747,7 +4748,7 @@ static void test_VarBstrFromR4(void) } }
- f = -1e-400; /* deliberately cause underflow */ + f = (-1 / flarge ) / flarge; /* deliberately cause underflow */ hres = pVarBstrFromR4(f, lcid, 0, &bstr); ok(hres == S_OK, "got hres 0x%08x\n", hres); if (bstr)