format-specifiers

Why does %e behave different than %g in format strings?

Why does %e behave different than %g in format strings? Question: I have tried this in Python2, Python3 and C: Why do these format string return numbers with different precision? >>> “%.3e” % 123456789 ‘1.235e+08’ >>> “%.3g” % 123456789 ‘1.23e+08’ Asked By: steffen || Source Answers: From the Python 3.7 documentation: ‘e’: Exponent notation. Prints …

Total answers: 3