Paste: babylonian method

Author: wolf
Mode: factor
Date: Wed, 3 Aug 2022 18:23:34
Plain Text |
: sqrt2 ( n+1 -- ~ )
    [ 0 > ]
    [| n+1 |
        n+1 1 - :> n
        n sqrt2 2 /
        n sqrt2 recip
        +
    ]
    [ 1 ]
    smart-if*
    ; inline recursive

Annotation: tests

Author: wolf
Mode: factor
Date: Wed, 3 Aug 2022 18:24:22
Plain Text |
{ 0 1 2 3 4 5 } [ sqrt2 >float ] map .

{
    1.0
    1.5
    1.416666666666667
    1.41421568627451
    1.41421356237469
    1.414213562373095
}

New Annotation

Summary:
Author:
Mode:
Body: