Originally shared by Thomas Mueller (dummzeuch)
Originally shared by Thomas Mueller (dummzeuch)
Today I had a curious bug: After changing the way GPS coordinates were read from a file (not calculated!) all of a sudden lots of unrelated floating point calculations had different results. I reverted the changes just to be sure and, yes, the results…
http://blog.dummzeuch.de/2018/09/06/if-your-floating-point-calculations-differ-after-a-trivial-change/
Today I had a curious bug: After changing the way GPS coordinates were read from a file (not calculated!) all of a sudden lots of unrelated floating point calculations had different results. I reverted the changes just to be sure and, yes, the results…
http://blog.dummzeuch.de/2018/09/06/if-your-floating-point-calculations-differ-after-a-trivial-change/
This is a problem with the old MS C++ Compilers. Not only on loading, it can also happen in a call to a Dll func. In our code we have lot of calls to fix that after a call. It can be a nightmare.
ReplyDeleteReminds the "fun" with printer drivers....
ReplyDeleteI wrote about this a while ago. There are some other issues as well. We had to chase this and other things down in CrossTalk about 10 years ago and it was a real bugger to figure out at the time.
ReplyDeleteAlso can be an issue when you write code that is compiled into a dll. Do you want your code changing the FPU state and impacting the host's code?
ReplyDeleteI'm still mulling on how changing back the control word will affect the calculation in the functions of this DLL. And how this affects multiple threads is also an unknown to me so far.
ReplyDeleteThomas Mueller I tend to set the control word to MS default before calling into third party DLLs. Then restore it when they return.
ReplyDeleteThreading is made more difficult because Set8087CW is not threadsafe.
I use a modified version (runtime code patching) of the RTL to fix many issues relating to FPU state.
Be sure to check the parameters you mentioned in blog.dummzeuch.de - Error regarding rtl240.bpl not found in stand alone version of GExperts Grep and https://blog.dummzeuch.de/2017/06/13/do-not-call-safeloadlibrarydllname-dll/
ReplyDeleteDavid Heffernan is that code available on-line somewhere for the public at large?
ReplyDeleteJeroen Wiert Pluimers the details are in one of my QC reports, but it's very messy.
ReplyDeleteDavid Heffernan thanks. If you have the QC number, let us know.
ReplyDeleteJeroen Wiert Pluimers, is the QC still online? I thought it was closed last year.
ReplyDeleteLeif Uneus I downloaded most of the ClientDataSet data (without attachments: it went down before I could try downloading them). Uwe Raabe created the QCScraper tool to do that: https://www.uweraabe.de/Blog/2017/06/09/how-to-save-qualitycentral/
ReplyDeleteJeroen Wiert Pluimers Yes, I downloaded that last year, but there are no attachments as you know. Anyway, the report you are looking for is probably QC107411 "Suggested re-design of RTL management of floating point control words"", and the zip file name is "Rethinking Delphi Floating Point Control Register Ma.zip". Note: it is stored with 7zip. I have the pdf here and can upload it to you if you like.
ReplyDeleteLeif Uneus yeah that's it, and my product OrcaFlex is built with that technique applied
ReplyDeleteLeif Uneus uploading the PDF would be nice. As the attachment is not in the archive spree that I initiated late 2017. web.archive.org - QualityCentral
ReplyDeleteJeroen Wiert Pluimers, here is a link to download the file:
ReplyDeletefilecloud.opsis.se - FileCloud : Secure Enterprise File Share and Sync Solution