Original worked examples
See the compromise in the numbers.
Each example uses the same exact objective: choose positive terms under both caps to minimize absolute ratio error. These are numerical illustrations, not physical design recommendations.
A short layout proportion
Enter target 1.777777777778, maximum numerator 20 and maximum denominator 20. The chosen pair is 16:9. Its value 16/9 is close to the entered decimal; its signed error is −1/4500000000000, about −0.000000000000222222. This remains an approximation, even though both values round to 1.777777777778 at twelve places.
The finite decimal you entered is exact for this calculation. It is not silently replaced by a familiar recurring fraction. If you want an exact match, the entered decimal must itself be representable by a legal pair.
A numerator cap changes the answer
Keep that target but set P = 8 and Q = 10. The pair 16:9 is no longer legal because its numerator exceeds 8. Ratiofit chooses 7:4, which equals 1.75. The signed error is −13888888889/500000000000, about −0.027777777778.
This is why a denominator-only approximation followed by simply limiting the numerator would not answer the stated question. Both caps participate in the search.
A diagonal-looking model proportion
For target 1.414213562373 with caps 20 and 20, the chosen pair is 17:12. Its exact signed error is 7359312881/3000000000000, about 0.002453104293666667. The positive sign means the achieved ratio is above the target.
The target may remind you of a mathematical constant, but this tool only knows the entered finite decimal. It neither evaluates that constant nor claims that 17:12 has a special geometric fit.
An exact decimal match reduces cleanly
Target 1.6 with caps 10 and 10 gives 8:5. Since 1.6 = 8/5 exactly, both signed and absolute errors are zero. Larger equivalent pairs such as 16:10 do not appear here because the numerator cap is 10; under larger caps the equivalent pair would still reduce to 8:5.
For target 1.25 with caps 20 each, 5:4, 10:8, 15:12 and 20:16 all describe the same value. The result is the reduced 5:4.
An exact tie and a one-trillionth change
Let P = 1 and Q = 2. The only distinct allowed ratios are 1/1 and 1/2. At target 0.75 they are both 1/4 away. The lower-value tie rule selects 1:2, with signed error −1/4.
Change only the target to 0.750000000001. Now 1/1 is closer, so the result becomes 1:1, with signed error 249999999999/1000000000000. At 0.749999999999, the result remains 1:2. Rounded displays must not decide these comparisons.
Targets beyond the available terms
With caps 10000 each, the smallest positive candidate is 1/10000. Enter 0.000000000001 and the nearest result is 1:10000, with positive error 99999999/1000000000000. No zero numerator is introduced to make the error look smaller.
At the other end, target 1000000 with those same caps gives 10000:1, with signed error −990000. The tool reports that the target is above the attainable interval; it does not replace the target before calculating the error.
Only one allowed pair
Set P = Q = 1. Every positive valid target has the sole legal pair 1:1. For target 0.125, the signed error is 7/8. A legal answer can be a poor approximation; the error display is what makes that limitation visible.
Try these values in Ratiofit. After each edit, press Calculate ratio. The guide explains the search proof, exact comparisons, input grammar and export behaviour.