I have a number that prints out in exponential form:
>>> >>> a = 1/1221759 >>> print(a) 8.184920266599223e-07 >>>
How can i make it print in normal form?
Print a float number in normal form, not exponential form / scientific notation [duplicate] Ask Question Asked9 years, 11 months ago Active2 years, 1 month ago
Use %E Format Specifier to Print Numbers in Scientific Notation Scientific notation for numbers is widely used to represent huge and small values with concise universal form. Namely, each number is represented with a single before the decimal point and power of 10s.
For example- 340 will be displayed as 3.4e+2 In the above example, the scientific notation of 512349000.000000 will be a decimal after the first digit and the power of 10 ie- 5.123490 X 108 To only include a certain number of digits after the decimal point, we use “ {:.Ne}”, where N is the number of digits.
The scientific notation means any number expressed in the power of 10.for example- 340 can be written in scientific notation as 3.4 X10 2 .in pythons, we use str.format () on a number with “ {:e}” to format the number to scientific notation. str.format () formats the number as a float, followed by “e+” and the appropriate power of 10.
You can format it as a fixed-point number.
>>> a = 1/1221759 >>> '{0:.10f}'.format(a) '0.0000008185'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With