Web lists-archives.com

Re: [Mingw-users] msvcrt printf bug




On 1/14/2017 10:02 PM, tei.andu@xxxxxxxxxxxx wrote:
>
> Hello,
> I encountered a loss of precision printing a float with C printf.
> For values greater than or equal to 1.743397235870361328125 * 2 ^
> 59 (0x5D5F27A4) the printed value is slightly wrong. The error
> increases with increasing input.

This is 19 digits:
   1005000082153537536

The output is fine. When the 32 bit float is converted into 64 
bits and then printed, it should be accurate up to about 17 
digits. I would not trust anything beyond 17 digits with my 
favorite teddy bear.

Why should one expect 19 digits of precision? Also, one should not 
expect 8087's extended precision registers to be used anymore 
unless it is explicitly required.

Do a round trip conversion, if you can't get back the number, then 
maybe we have a problem. If you can get back the number, then 
there is no problem, only a difference in expectations.

> I attached a sample C file.
> I tested against glibc 2.2.5 and against my own float to string.
> The bug is in msvcrt. My msvcrt version is 7.0.7601.17744, crc32:
> DAB48B3A
> mingw version: 4.0; gcc version: 5.3.0
> Can anyone please confirm this?
> I am sorry if this was posted before, I couldn't find anything.


-- 
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
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