Reputation: 6800
In Python, is there a good way to divide 1 over 0.99 immediately resulting in 1.01?
In other words, I am dividing a lot (and by a lot I mean millions) of doubles that are rounded to the second place after the decimal. If I divide 1 over 0.99 in Python I get 1.0101010101010102. All I need is the 1.01 portion of this number.
I am aware of the fact that I can round the result, but this is super slow in the context of my application. Is there a faster way to divide two numbers and get a result that is rounded already?
Thanks!
Upvotes: 2
Views: 711