pyCharm pro 2019.1.3 can't print float number of exponential notation correctly?
Hi All,
Today I downloaded pyCharm Professional version 2019.1.3, and tried to the following statements:
z=1.2e2
print('{:f}'.format(z))
And the code gave me the result:
1120.000000
However, when I tried python3 command line interpreter, it gave the right answer as:
1200.000000
Did I do anything wrongly?
请先登录再写评论。
Hi, this code (let me quote it again just in case):
Produces the same result regardless of the interpreter in my case:
120.000000
1.2e2 = 120 in decimal
From python docs: "f" - Fixed-point notation. Displays the number as a fixed-point number. The default precision is
6.Therefore the correct answer is 120.000000
Correct. I double-checked my script after and found it was a leftover from the previous line.
Sorry for the late night coding confusion.