Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
22
Task/Nth-root/FutureBasic/nth-root.futurebasic
Normal file
22
Task/Nth-root/FutureBasic/nth-root.futurebasic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
include "ConsoleWindow"
|
||||
|
||||
def tab 8
|
||||
|
||||
local fn NthRoot( root as long, a as long, precision as double ) as double
|
||||
dim as 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 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue