4 ms·
Here is a correction which m akes it exactly 8.0: > 987654320 / 123456790 8.0 I've decremented the numerator and incremented the denominator: ( 987654
by kazinator 1y ago
Here is a correction which m akes it exactly 8.0:
> 987654320 / 123456790
8.0
I've decremented the numerator and incremented the denominator:
( 987654321 - 1 )
----------------- = 8
( 123456789 + 1 )
Works in other bases. TXR Lisp, base 4:
1> (/ (poly 4 '(3 2 1)) (poly 4 '(1 2 3)))
2.11111111111111
2> (/ (poly 4 '(3 2 0)) (poly 4 '(1 2 4)))
2.0
It also works for base 2, which is below the lowest base used in the article: the Python code goes from 3.
For base 2, the ratio is 1/1. When we apply the correction, we get (1 - 1) / (1 + 1) = 0, which is 2 - 2.