Jump to content

Nth root: Difference between revisions

Line 2,371:
{{trans|D}}
<syntaxhighlight lang="langur">writeln "operator"
writeln( (7131.5 ^ 10) ^/ 10 )
writeln 64 ^/ 6
writeln()
 
val .nthroot = ffn(.n, .A, .p) {
# 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 "calculationfunction"
writeln .nthroot(10, 7131.5 ^ 10, 0.001)
writeln .nthroot(6, 64, 0.001)</syntaxhighlight>
Line 2,395:
2
 
function
calculation
7131.5
2
1,007

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.