3 ms·
For anyone else who was puzzled at this result (rather than 1/3): The above algorithm is finding something with the relative error of at most .005 times the inp
by jepler 3y ago
For anyone else who was puzzled at this result (rather than 1/3): The above algorithm is finding something with the relative error of at most .005 times the input value 0.33. 1/3 is the best value for the absolute error of at most .005.
- eesmith 3y agoOhh, indeed. I was thinking of measurement tolerances. Replace: delta = mid * Fraction("0.005") with delta = Fraction("0.005") and I get: Found: 1/3 13/40 <= 1/3 <= 67/200? True
- CodesInChaos 3y agoI definitely meant an absolute error of 0.005, since the error approach was a generalization of "produces 0.33 when rounded to 2 decimal digits".