>> Rodney Roberts IS & Education Professional Homepage >> Programming Tutorials And Downloads
Science makes it known,

Silverfrost Fortran 95 subroutine to compute Nth Root of X
NROOT is a REAL*8 function in
sttstcs.dll
(called by subroutine GEOMEAN in the same .dll). It
has been tested for X up to 95^{36}, and is callable by D,
Pascal, and FORTRAN.
C X**(1/N) REAL*8 FUNCTION NROOT (X, N) RESULT (ROOTN) REAL*8 X, ROOTN, T2, A1, A2, D REAL T1, EPS INTEGER*2 N, N2, I PARAMETER (EPS=0.000005) ROOTN = X IF ((N.EQ.1).OR.(N.LE.1)) GO TO 100 IF (N.EQ.0) THEN ROOTN = 1 GO TO 100 ENDIF I = 0 A1 = SQRT(SQRT(X)) !Begin Seed the nth root IF (X.GT.448000) THEN !to prevent overflow for large X A1 = SQRT(A1) !and reduce number of iterations ENDIF IF (X.GT.(1.0D70)) THEN A1 = SQRT(A1) ENDIF IF (X.GT.(1.0D99)) THEN A1 = SQRT(A1) ENDIF IF (X.GT.(1.0D199)) THEN A1 = SQRT(A1) ENDIF IF (N.GT.25) THEN A1 = SQRT(A1) ENDIF !End Seed the nth root N2 = N  1 T1 = 1.0/FLOAT(N) C PRINT FORTRAN Statements
1. Download includes fixes to take odd roots of negative numbers, exit with zero for even root of negative number. Source file also includes REAL*8 FUNCTION RPOWER (X, P) RESULT (R). Using natural logarithms, raises X to real power P. Initial tests (called by Object Pascal) have been successful. Thanks to Scientific Psychic for the square root HTML code, gmplib.org for the algorithm 
Any and all © copyrights, ® ™ trademarks, or other
intellectual property (IP) mentioned here are the property of
their respective owners. No infringement is intended.
Feel free to use any of the above in your project (without violating any intellectual property rights); please give credit (same idea as Copyleft). The source code files available for download on these pages are enhanced and tested periodically  check for revised versions. Page best viewed with Mozilla FireFox 3.6.13 (or higher), Q4OS Konqueror R14.0.4. 
Web hosting provided by

,  ,  .  ,  .  , & 