Skip to content

Instantly share code, notes, and snippets.

@arkiuat
Last active December 14, 2025 21:21
Show Gist options
  • Select an option

  • Save arkiuat/776108f3a06100d2178c80170054bb14 to your computer and use it in GitHub Desktop.

Select an option

Save arkiuat/776108f3a06100d2178c80170054bb14 to your computer and use it in GitHub Desktop.
Mueller's convergence
#!/usr/bin/env raku
# Mueller's convergence, from p. 14 of
# https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf
constant x0 = 4.FatRat;
constant x1 = (4.25).FatRat;
sub MAIN(Int $n) {
say iter-oe $n;
}
sub oe(FatRat $y, FatRat $z --> FatRat) {
108.0 - ( 815.0 - 1500.0 / $z ) / $y
}
sub iter-oe(Int $n --> FatRat) {
do given $n {
when 0 { x0 }
when 1 { x1 }
when 2 { oe( x1, x0 ) }
when 3 { oe( iter-oe(2), iter-oe(1) ) }
default { oe( iter-oe($n-1), iter-oe($n-2) ) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment