Web lists-archives.com

Re: [Mingw-users] msvcrt printf bug




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 18/01/17 23:34, Emanuel Falkenauer wrote:
> Trouble is, it's NOT trivial to stop before that limit with printf. 
> Sure, I could print %.2f when the two digits are the only valid ones,
>  but that would prevent me from correctly printing e.g. 0.00001234 so
>  that it would show differently from 0.00001236 (even though both
> only have four significant digits). I simply didn't find a reliable
> way of printing those floats when they vary by orders of magnitude.

"%.2f" doesn't specify significant digits -- it specifies digits
after the radix point.  If you want to see, and compare, just so
many significant digits, you would surely be better off using
"%.2e", (so you don't get the leading insignificant zeros).

One other potential issue, which I neglected to mention: when you
perform floating point calculations you may suffer rounding, or
even cancellation effects, all of which conspire to make even less
than the absolute maximum representable precision available.  This
may be further compounded by differing FPU configuration between
implementations -- e.g. it is my understanding that Microsoft
configure the FPU to operate in 8-byte register mode, whereas
GCC uses full 10-byte capability.  Such configuration differences
could lead to rounding differences, even within the available
53-binary/15.955-decimal digit precision limit.

> I would LOVE to use _your_ printf... but remember: the whole story is 
> about comparing with Borland builds, where it's not available.

Well, you are always likely to be on a hiding to nothing, when
you compare apples with oranges, and expect identity -- in this
case, how can you possibly expect consistency between Borland's
proprietary (likely undisclosed) algorithm and A. N. Other's?

If you want guaranteed consistency, you'd better use identically
the same algorithm; what's to stop you compiling, and using, our printf() in your Borland builds, in place of their proprietary
alternative?

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJYgAoSAAoJEMCtNsY0flo/DnYP/jtDytQ4YNJjdaWNFix69qT7
weg8Y/61UjLaxiJag4LY2CR9n4X8lAxQJtwUT1gS7m3RM8O48Vhgxma2I1xXc0p3
L2tieGI2Mt1zLwnjJx6XJIFNwSUj0VhcSdYnhlWF6rROXqOqOM9s/XTH2gn3EvBU
mXccqebDzK7yR4anRw2qhUj+ojAjYgp1s54W79OmHfHRR3tRJ0F3mmDtBfLUFCrk
uL9maVxdcNOuAuP1UeVsqfPSxmB5s62U1islKtvXayrCzXM3f7qMxn4w4fF/cv7J
h9fexvRuGygHT3QFl0zlBUHcvNdzuJwj1Idl3ffOjfvUhjU5R5gV6Jd0vjGTYBl2
heh3Gp0rE92HAMqfkfWzBDEdz0vTLkPKsnn8x1INof4Wy/lkhtPQj9ah4yYscKQ5
PKlVaPNzMJD0kzbm26WUzZCcr0dE5e8YR1oAn8Fq9Rz/iV1E66tPW7exVqcFpWQk
rurH3bi/ob5ARtit15JQyt2QMwKEexcMaenV00jn9hs+WUJQt9Cv5tXj6JYRHltM
9fVgZIxtcO3vi6DoT/N1YPciTE/F1jAuogiE2iQRZWwqc0UkGBYZDeU5MFS9i8WX
cht6jKJqUbGn0PcIiwfj+3UZ2RylyVMHfLZoU8lB6CQXru0uBeoUZF8EtLxvOr01
cUZRWBuFhpk96CvQjA7j
=0dt+
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
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