FNLMath : Utilities : HYPOT
HYPOT
This functions computes SQRT(A**2 + B**2) without underflow or overflow.
Function Return Value
HYPOTSQRT(A**2 + B**2). (Output)
Required Arguments
A — First parameter. (Input)
B — Second parameter. (Input)
FORTRAN 90 Interface
Generic: HYPOT (A, B)
Specific: The specific interface names are S_HYPOT and D_HYPOT.
FORTRAN 77 Interface
Single: HYPOT (A, B)
Double: The double precision name is DHYPOT.
Description
Routine HYPOT is based on the routine PYTHAG, used in EISPACK 3. This is an update of the work documented in Garbow et al. (1972).
Example
Computes
where a = 1020 and b = 2 × 1020 without overflow.
 
USE HYPOT_INT
USE UMACH_INT
 
IMPLICIT NONE
! Declare variables
INTEGER NOUT
REAL A, B, C
!
A = 1.0E+20
B = 2.0E+20
C = HYPOT(A,B)
! Get output unit number
CALL UMACH (2, NOUT)
! Print the results
WRITE (NOUT,'(A,1PE10.4)') ' C = ', C
END
Output
 
C = 2.2361E+20
Published date: 03/19/2020
Last modified date: 03/19/2020