Anonymous user
Continued fraction: Difference between revisions
Updated D entry
m (→Version 1: added note about omitted ß are assumed to be equal to unity; carefully clarified a cosmetic comment. -- ~~~~) |
(Updated D entry) |
||
Line 192:
=={{header|D}}==
<lang d>import std.typecons;
alias Tuple!(int,"a", int,"b") Pair;
FP calc(FP, F)(in F fun, in int n) pure nothrow {
FP temp =
foreach_reverse (ni; 1 .. n+1) {
immutable
temp = cast(FP)
}
return cast(FP)fun(0)
}
// int[2] fsqrt2(in int n) pure nothrow {
return
}
return
}
return
}
void main() {
import std.stdio;
writefln("%.19f", calc!real(&fsqrt2, 200));
writefln("%.19f", calc!real(&fnapier, 200));
|