Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print a float number in normal form, not exponential form / scientific notation [duplicate]

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?

like image 947
kafedakias Avatar asked Oct 18 '11 01:10

kafedakias


People also ask

Is it possible to print float numbers 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

How to use%e format in scientific notation?

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.

What is the scientific notation for 340?

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.

How to write numbers in scientific notation in Python?

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.


1 Answers

You can format it as a fixed-point number.

>>> a = 1/1221759 >>> '{0:.10f}'.format(a) '0.0000008185' 
like image 67
Jeff Mercado Avatar answered Nov 03 '22 19:11

Jeff Mercado