Web lists-archives.com

Re: [Mingw-users] msvcrt printf bug




Hi Tei Andu(?),

I've been following this thread from afar but with a huge interest - and as far as I'm concerned, you certainly did not offend anybody!

For all sorts of reasons, we develop and debug our algorithms in Embarcadero RAD Studio (a.k.a. "Borland") but, being in HPC, execution speed is paramount for our products and MinGW has proved unbeatable there (excellent work, people!!), so it's MinGW builds (both 32- and 64-bit) we ship - in short, we build our algorithms in two different compilers.

Now to debug in Embarcadero a problem found in a MinGW build, we must be sure that the two versions behave exactly the same, and it's anyway a good QC practice to make sure that that is indeed the case. In order to do that, we have developed a whole tracing system where one version writes the details of its progress into a log and the other version then reads it to spot any differences in behavior. The system already saved us years in debugging... but floats have always been a problem: Embarcadero and MinGW don't (s)print(f) them the same! The last digit in the log is different so often, that many times the logging becomes largely useless: millions of BOGUS differences show up.
Usually we resign ourselves to use sprintf("%.4f",...) or such, and skip by hand what are clearly bogus "differences" remaining - but that always leaves the uncertainty that the differences COULD actually be real, i.e. that the exact float values are really different in the two builds.

So as you may guess, I grabbed your pastebin the minute you posted it, adapted it for our purposes (mainly to print into a char[]) and tested it immediately (in 64-bit MinGW and 32-bit Embarcadero so far) - and my conclusion is that your put_f32(float f32) works EXACTLY AS ADVERTISED: both our builds now generate exactly the same logs.

This is really INVALUABLE for us, as it will save us years of debugging headaches. So I would not only like to THANK you a lot, but also give you credit in our adapted sources - how would you like us to refer to you as the original author?

Many thanks again,

Emanuel


On 18-Jan-17 00:44, tei.andu@xxxxxxxxxxxx wrote:
I messed up the pastebin. Forgot float union. Fixed:
http://pastebin.com/zeLeD021
--
Securely sent with Tutanota. Claim your encrypted mailbox today!
https://tutanota.com

18. Jan 2017 00:28 by mingw-users-request@xxxxxxxxxxxxxxxxxxxxx:

I put my code on pastebin: http://pastebin.com/svxrefSy



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot


_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe