I have three variables a, b and c. I want to find out the largest value for b where a*b is not greater than c. I want to make sure that after doing this:
c -= a*b
c is not negative. Note that I don't want to set the value of c by c = max(0,c-a*b). I want to make sure that b is not big enough to make c negative.
I am doing this for now:
if a*b > c:
b = c // a
but for very large numbers, I still get negative value in c. what should I do?
To reproduce the error here are some sample numbers:
a = 5.195497498518083
b = 1.0813434626413702e+16
c = 5.614533816817397e+16
I have tried the solution in the linked question but it does not solve the problem. I tried this:
Fraction(str(c)) // Fracktion(str(a))