Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Nth-root/FutureBasic/nth-root.basic
Normal file
22
Task/Nth-root/FutureBasic/nth-root.basic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
window 1
|
||||
|
||||
local fn NthRoot( root as long, a as long, precision as double ) as double
|
||||
double x0, x1
|
||||
|
||||
x0 = a : x1 = a /root
|
||||
while ( abs( x1 - x0 ) > precision )
|
||||
x0 = x1
|
||||
x1 = ( ( root -1.0 ) * x1 + a / x1 ^ ( root -1.0 ) ) /root
|
||||
wend
|
||||
end fn = x1
|
||||
|
||||
print " 125th Root of 5643 Precision .001",, using "#.###############"; fn NthRoot( 125, 5642, 0.001 )
|
||||
print " 125th Root of 5643 Precision .001",, using "#.###############"; fn NthRoot( 125, 5642, 0.001 )
|
||||
print " 125th Root of 5643 Precision .00001", using "#.###############"; fn NthRoot( 125, 5642, 0.00001 )
|
||||
print " Cube Root of 27 Precision .00001", using "#.###############"; fn NthRoot( 3, 27, 0.00001 )
|
||||
print "Square Root of 2 Precision .00001", using "#.###############"; fn NthRoot( 2, 2, 0.00001 )
|
||||
print "Square Root of 2 Precision .00001", using "#.###############"; sqr(2) // Processor floating point calc deviation
|
||||
print " 10th Root of 1024 Precision .00001", using "#.###############"; fn NthRoot( 10, 1024, 0.00001 )
|
||||
print " 5th Root of 34 Precision .00001", using "#.###############"; fn NthRoot( 5, 34, 0.00001 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue