Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -4,12 +4,14 @@ end = exp((1.0 / n) * log(x))
rem - exercise the routine by finding successive roots of 144
var i = integer
var x = real
print "Finding the nth root of x"
x = 144
print "Finding the nth root of"; x
print " x n root"
print "-----------------------"
for i = 1 to 8
print using "### #### ###.####"; 144; i; nthroot(144, i)
print using "### #### ###.####"; x; i; nthroot(x, i)
next i
end

View file

@ -1,8 +1,8 @@
rem - return the nth root of real.double value x to stated precision
rem - return the nth root of x to stated precision
function nthroot(n, x, precision = real.double) = real.double
var x0, x1 = real.double
x0 = x
x1 = x / n rem - initial guess
x1 = x / n rem - initial guess
while abs(x1 - x0) > precision do
begin
x0 = x1
@ -13,11 +13,14 @@ end = x1
rem -- exercise the routine
var i = integer
print "Finding the nth root of 144 to 6 decimal places"
var x = real.double
x = 144
print "Finding the nth root of"; x; " to 8 decimal places"
print " x n root"
print "------------------------"
for i = 1 to 8
print using "### #### ###.######"; 144; i; nthroot(i, 144.0, 1E-7)
for i = 2 to 8
print using "### #### ###.########"; x; i; nthroot(i, x, 1E-9)
next i
end