Mark Dickinson wrote: > On Wed, Jul 16, 2008 at 3:35 PM, Eric Smith > <eric+python-dev at trueblade.com> wrote: >> Does anyone know why 'F' is the same as 'f'? Wouldn't it make more sense to >> either drop it, or make it convert the exponent to upper case > > What exponent? Isn't the point of 'f' formatting that there is no exponent? There's no exponent until the number gets large. I haven't looked up how big the number has to get. On my Mac, it's somewhere between 1e50 and 1e60. $ ./python.exe Python 3.0b1+ (py3k:64984:64985, Jul 15 2008, 20:17:06) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> '%f' % 1e100 '1e+100' >>> '%F' % 1e100 '1e+100' >>> '%f' % 1.2 '1.200000' str.format() works the same. > In C, the only difference seems to be that a NaN or infinity formatted with '%F' > is turned into "NAN" or "INF" instead of "nan" or "inf". Not so in Python. >>> '%f' % float('nan') 'nan' >>> '%F' % float('nan') 'nan' But it is the case with 'e': >>> '%e' % float('nan') 'nan' >>> '%E' % float('nan') 'NAN'
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4