IBConnection failed test TTestFieldTypes.TestFmtBCDParamQuery
Original Reporter info from Mantis: lacak @lacak.sk
-
Reporter name: LacaK
Original Reporter info from Mantis: lacak @lacak.sk
- Reporter name: LacaK
Description:
Running fcl-db test suite on Windows9x:
&LtPos;test name="TTestFieldTypes.TestFmtBCDParamQuery">
&LtPos;failure ExceptionClassName="EAssertionFailedError">
&LtPos;message> expected: <-54.3333> but was: <-54.333299999999994>&LtPos;/message>
&LtPos;/failure>
&LtPos;/test>
This error is caused by changing FPU control word (precision from $1372 to $1272, from 64bit precision to 53bit precision), which leads to wrong results of PowerInt function used in ibconnection.pp
Resolution is save/restore control word around the "problematic" calls.
Patch, which works for me is attached.
Additional information:
It seems, that this error (changing FPU control word in LoadLibrary and isc_attach_database) occurs only on Windows9x platform (for example on Windows Vista FPU control word does not change)
Simple test program:
var
LibraryHandle: TLibHandle;
cw: word;
begin
cw:=Get8087CW;
writeln('CW before:',cw, ' IntPower:', intpower(10,-6));
LibraryHandle:=LoadLibrary('odbc32.dll');
writeln('CW after:',Get8087CW, ' IntPower:', intpower(10,-6));
Set8087CW(cw);
end.
Output:
CW before:4978 IntPower: 1.0000000000000000E-0006
CW after:4722 IntPower: 2.0000000000000000E-0006 <--- Wrong result of IntPower!
Mantis conversion info:
- Mantis ID: 20011
- OS Build: Windows 98
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 20154 (#c729bd7a)