We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Also, here is an example of an effect of the loss of precision for floats (Python):
7.0/3.0 - 4.0/3.0 - 1.0 ->
2.220446049250313e-16
7.0/3.0 - 4.0/3.0 - 1.0 == 0 -> False
(10.0/3.0) / (4.0/3.0) ->
2.5000000000000004
(10.0*3.0)/(4.0*3.0) ->
2.5
The two last ones should show you what the loss of precision can do. It is the same exact equation, but with two slightly different results (albeit equal up to the 15th decimal).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Python: Division
You are viewing a single comment's thread. Return to all comments →
Well, for one, integer division is much faster.
Also, here is an example of an effect of the loss of precision for floats (Python):
The two last ones should show you what the loss of precision can do. It is the same exact equation, but with two slightly different results (albeit equal up to the 15th decimal).