Continued fractions & convergents
Inspect rational convergents of a supplied decimal number.
A clear answer. Here’s how.
Repeatedly takes the floor and reciprocal fractional part, building exact BigInt numerators and denominators for each convergent. Supports negative values using floor-based coefficients. Stops at a fractional remainder below 10⁻¹⁴ or 30 terms and rejects coefficients outside the safe integer range. The source is a floating-point decimal; late convergents may describe rounding rather than a symbolic irrational.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Decimal value
- 3.141592653589793
- Maximum terms
- 10
Example result
| Term | Coefficient | Numerator | Denominator | Approximation | Absolute difference |
|---|---|---|---|---|---|
| 1 | 3 | 3 | 1 | 3 | 0.14159265359 |
| 2 | 7 | 22 | 7 | 3.14285714286 | 0.00126448926735 |
| 3 | 15 | 333 | 106 | 3.14150943396 | 0.0000832196275291 |
| 4 | 1 | 355 | 113 | 3.14159292035 | 0.000000266764189405 |
| 5 | 292 | 103993 | 33102 | 3.14159265301 | 0.000000000577890624243 |
Continued fractions describe the supplied floating-point number, not an exact symbolic irrational. Later convergents may reflect rounding.