Nth root: Difference between revisions
→{{header|langur}}
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 2,371:
{{trans|D}}
<syntaxhighlight lang="langur">writeln "operator"
writeln
writeln 64 ^/ 6
writeln()
# To make the example from the D language work, we set a low maximum for the number of digits after a decimal point in division.▼
mode divMaxScale = 7▼
▲val .nthroot = f(.n, .A, .p) {
var .x = [.A, .A / .n]
while abs(.x[2]-.x[1]) > .p {
Line 2,386 ⟶ 2,383:
}
▲# To make the example from the D language work, we set a low maximum for the number of digits after a decimal point in division.
writeln "calculation"▼
▲mode divMaxScale = 7
writeln .nthroot(10, 7131.5 ^ 10, 0.001)
writeln .nthroot(6, 64, 0.001)</syntaxhighlight>
Line 2,395:
2
function
7131.5
2
|