+ 2

>>>100*(11/10) 110.00000000000001 >>>100*11/10 110.0 Why??

3rd Apr 2019, 8:58 PM
Hicham Lamghari
Hicham Lamghari - avatar
3 Respostas
+ 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
3rd Apr 2019, 9:29 PM
Hubert Dudek
Hubert Dudek - avatar
+ 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
18th Apr 2019, 1:14 AM
Yash Srivastava
Yash Srivastava - avatar
+ 1
Hubert Dudek Thank you so much🌹
3rd Apr 2019, 9:34 PM
Hicham Lamghari
Hicham Lamghari - avatar