Web lists-archives.com

Re: [Mingw-users] msvcrt printf bug




> Yes, I did.  I fully understood that your holy grail was
> consistency, even if that equates to "consistently imprecise",
> or "consistently inaccurate".

Correct.

> That's absolutely fine, but, once
> you go beyond the limit of representable precision inherent in
> the underlying data type, you become dependent on fiction; the
> only way to guarantee consistency in that fiction is to employ
> identically the same algorithm to produce it ... and the further
> you go beyond that limit of precision, the less likely it may
> become that such consistency is preserved -- realistically, you
> should never look more than two digits beyond floor(N*log10(2))
> in any case.

Incorrect: I never said I would like to "see" beyond the precision limit!

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.

> So, if you want consistency in printf()'s imprecision, then you
> should be using _our_ printf(), (which uses, AFAIK, identically
> the same algorithm as both cygwin and GNU's glibc); Microsoft
> use their own algorithm, which is thus most unlikely to yield
> the same output, _beyond the limit of representable precision_.

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

> My point was that there is a significant volume of ill-informed
> nonsense pervading the internet, which encourages the naive, and
> the ignorant, to believe that float, double, and long double can
> accurately represent many more digits of precision than the
> number of available bits in the underlying data type can
> physically sustain; I get utterly fed up with dismissing "bug"
> reports to the effect that printf( "%.20e", foo ) prints the wrong
> value in the least significant digits, when "%.15e" is the most
> that can dependably produce _accurate_ results; (the additional
> five digits, requested by "%.20e", are speculative).

Once again, this was always understood - at the very least I never 
argued otherwise.

Best,

Emanuel

> - -- 
> Regards,
> Keith.
>

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