fastmath

Module

Description

This module computes a fast inverse square root

Algorithm originally in C by Chris Lomont, implemented here in Fortran by Daniel Price

Provides generic interface finvsqrt referring to both the single and double precision versions

This is a standalone module which has no dependencies

For fast sqrt, just use sqrt(x) = x*finvsqrt(x)

References:

Chris Lomont, “Fast Inverse Square Root” www.math.purdue.edu/~clomont

Owner:

Daniel Price

Runtime parameters:

None

Dependencies:

None

Quick access

Variables:

dfastinvsqrt, fastinvsqrt, finvsqrt

Routines:

checksqrt(), testsqrt()

Variables

  • fastmath/dfastinvsqrt [private]
  • fastmath/fastinvsqrt [private]
  • fastmath/finvsqrt [public]

Subroutines and functions

subroutine  fastmath/testsqrt(ierr, output)
Parameters:
  • ierr [integer,out]

  • output [logical,in]

Called from:

test_math()

Call to:

checksqrt()

subroutine  fastmath/checksqrt(x, tol, ierr, output)
Parameters:
  • x [real,in]

  • tol [real,in]

  • ierr [integer,inout]

  • output [logical,in]

Called from:

testsqrt(), test_math()