older-version
|
a.tgz,
f.00,
f.1,
f.10,
f.11,
f.12,
f.13,
f.14,
f.15,
f.16,
f.17,
f.18,
f.19,
f.2,
f.20,
f.21,
f.22,
f.23,
f.24,
f.25,
f.26,
f.27,
f.28,
f.29,
f.3,
f.30,
f.31,
f.32,
f.33,
f.34,
f.35,
f.36,
f.37,
f.4,
f.5,
f.6,
f.7,
f.8,
f.9
|
|
|
C *******************************************************************
C ** THIS FORTRAN CODE IS INTENDED TO ILLUSTRATE POINTS MADE IN **
C ** THE TEXT. TO OUR KNOWLEDGE IT WORKS CORRECTLY. HOWEVER IT IS **
C ** THE RESPONSIBILITY OF THE USER TO TEST IT, IF IT IS USED IN A **
C ** RESEARCH APPLICATION. **
C *******************************************************************
C *******************************************************************
C ** FICHE F.18 **
C ** FUNCTION TO COMPUTE SQUARE ROOT FASTER THAN FORTRAN SQRT. **
C *******************************************************************
REAL FUNCTION SSQRT ( XSQ )
C *******************************************************************
C ** FUNCTION TO COMPUTE SQUARE ROOT FASTER THAN FORTRAN SQRT. **
C ** **
C ** THIS FUNCTION RETURNS THE SQUARE ROOT OF A REAL NUMBER XSQ **
C ** WITH 0.1 < XSQ < 1.0. THE METHOD USES A POLYNOMIAL **
C ** APPROXIMATION FOLLOWED BY NEWTON-RAPHSON ITERATION. **
C ** **
C ** REFERENCES: **
C ** **
C ** SINGER, CCP5 QUARTERLY, 8, 47, 1983. **
C ** POWLES, CCP5 QUARTERLY, 11, 39, 1984. **
C ** **
C ** PRINCIPAL VARIABLES: **
C ** **
C ** REAL XSQ THE NUMBER WHOSE SQUARE ROOT IS REQUIRED **
C ** REAL X THE SQUARE ROOT **
C ** REAL C0,C1,C2,C3 COEFFICIENTS IN THE POLYNOMIAL APPROX. **
C *******************************************************************
REAL XSQ
REAL X
REAL C0, C1, C2, C3
PARAMETER ( C0 = 0.188030699, C1 = 1.48359853 )
PARAMETER ( C2 = -1.0979059 , C3 = 0.430357353 )
C *******************************************************************
C ** POLYNOMIAL APPROXIMATION TO X **
X = C0 + XSQ * ( C1 + XSQ * ( C2 + XSQ * C3 ) )
C ** ITERATION OF APPROXIMATION **
X = X + 0.5 * ( XSQ / X - X )
X = X + 0.5 * ( XSQ / X - X )
SSQRT = X + 0.5 * ( XSQ / X - X )
RETURN
END
|