[Guido]
> My best guess as to why 'F' is the same as 'f' is that somebody
> (could've been me :-) thought, like several others in this thread,
> that %f never prints an exponent. I agree that making it emit an 'E'
> when an exponent is used is the right thing to do. Do it now!

The C standard doesn't allow for %f (or %F) to produce an exponent.
That appears to be a Python innovation.  People should try their
examples under their native C compiler instead (best I can tell, the
idea that %f/%F can produce an exponent came only from running Python
examples, never from running C examples).

For example,

"""
#include <stdio.h>

int main() {
    printf("%f\n", 1e300);
}
"""

Under the Cygwin gcc, that displays (the admittedly atrocious, but
that's why people shouldn't use %f inappropriately to begin with ;-)):

100000000000000005250476025520442024870446900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000.000000

As far as C is concerned, the only difference between %f and %F is:

    The F conversion specifier  produces INF, INFINITY, or NAN instead of inf,
    infinity, or nan, respectively
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to