Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

The question datetime – Delphi Now() function returns a wrong value – Stack Overflow is similar to my article Delphi – Michael Justin had strange floating point results when his 8087 FPU Control Word got hosed.

Good that stackoverflow user Anton Zhuchkov found out the cause himself: his answer indicates the Precision Control (and rounding) part of the FPU state got hosed by wrongly initializing the Direct3D device.

I edited his answer with some extra links to documentation.

Finally I’ve found the solution. I needed to specify the D3DCREATE_FPU_PRESERVE flag when creating a D3D device by D3D.CreateDevice.

Otherwise, without that flag, all floating point operations are performed with single precision. As the TDateTime is a simple Double, and Now() functions is consist of simple addition of date value to time value, it all get messed up by DirectX “smart” override.

Problem solved. It was a tricky one indeed. :)

–jeroen

via: datetime – Delphi Now() function returns a wrong value – Stack Overflow.


Filed under: Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development

Viewing all articles
Browse latest Browse all 1725

Trending Articles