This functions computes SQRT(A**2 + B**2) without underflow or overflow.
HYPOT — SQRT(A**2 + B**2). (Output)
A — First parameter. (Input)
B — Second parameter. (Input)
Generic: HYPOT (A, B)
Specific: The specific interface names are S_HYPOT and D_HYPOT.
Single: HYPOT (A, B)
Double: The double precision name is DHYPOT.
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).
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
C = 2.2361E+20
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |