COSDG

This function evaluates the cosine for the argument in degrees.

Function Return Value

COSDG — Function value. (Output)

Required Arguments

X — Argument in degrees for which the cosine is desired. (Input)

FORTRAN 90 Interface

Generic: COSDG (X)

Specific: The specific interface names are S_COSDG and D_COSDG.

FORTRAN 77 Interface

Single: COSDG (X)

Double: The double precision function name is DCOSDG.

Description

To avoid unduly inaccurate results, the magnitude of x must not be so large that the integer part fills more than the computer word. Under no circumstances is the magnitude of x allowed to be larger than the largest representable integer because complete loss of accuracy occurs in this case.

Example

In this example, cos 100° computed and printed.

 

USE COSDG_INT

USE UMACH_INT

 

IMPLICIT NONE

! Declare variables

INTEGER NOUT

REAL VALUE, X

! Compute

X = 100.0

VALUE = COSDG(X)

! Print the results

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) X, VALUE

99999 FORMAT (' COS(', F6.2, ' deg) = ', F6.3)

END

Output

 

COS(100.00 deg) = -0.174