+ 2
>>>100*(11/10) 110.00000000000001 >>>100*11/10 110.0 Why??
3 Antworten
+ 6
Internally there is fixed number of binary digits. So numbers are not represent exactly. Read here https://docs.python.org/3/tutorial/floatingpoint.html if you really need exact numbers please use decimal library
+ 4
In first fragment bracket will be solved first so it gives the output
110.000000...1
100*(11/10)
step 1
100*(1.100000000001)
step 2
100*1.1000000000001
answer
110.0000000000001
And for second fragment
Multiplication is first and then division will take place in later step
as the answer is 110.0
step1
in presidency series the '*' operator comes first so
100*11/10
1100/10
answer after devision
will be
110.0
+ 1
Hubert Dudek Thank you so much🌹