geometric functions

Function:

ACOS

Function Name:

Arccosine

Syntax:

ACOS(n)

Description:

Returns a value, in radians, that approximates cos-1(n), where –1 <= n <= 1. The result will be in the range 0 <= cos-1(n) <= p.

Example Usage:

ACOS(0)

Return Value:

1.570796327 (approximates p/2)




Function:

ACOSH

Function Name:

Inverse hyperbolic cosine

Syntax:

ACOSH(n)

Description:

Returns cosh-1(n), where n >= 1, and cosh(n) is equivalent to the expression

(en + e-n )

2

Example Usage:

ACOSH(5.25)

Return Value:

2.3421 (for PIC format 9.9999)




Function:

ASIN

Function Name:

Arcsine

Syntax:

ASIN(n)

Description:

Returns a value, in radians, that approximates sin-1(n), where –1 <= n <= 1. The result will be in the range -p/2 <= sin-1(n) <= p/2.

Example Usage:

ASIN(1)

Return Value:

1.570796327 (approximates p/2)




Function:

ASINH

Function Name:

Inverse hyperbolic sine

Syntax:

ASINH(n)

Description:

Returns sinh-1(n), where n >= 1, and sinh(n) is equivalent to the expression

(en – e-n )

2

Example Usage:

ASINH(5.25)

Return Value:

2.3603 (for PIC format 9.9999)





Function:

ATAN

Function Name:

Arctangent

Syntax:

ATAN(n)

Description:

Returns a value, in radians, that approximates tan-1(n), where -¥ <= n <= ¥. The result will be in the range -p <= tan-1(n) <= p.

Example Usage:

ATAN(1)

Return Value:

0.7853981634 (approximates p/4)




Function:

ATAN2

Function Name:

Arctangent of y/x

Syntax:

ATAN2(x, y)

Description:

Returns a value, in radians, that approximates tan-1(y/x), where -¥ <= n <= ¥. The result will be in the range -p <= tan-1(n) <= p. ATAN2 allows a zero-valued argument for x.

Example Usage:

ATAN2(0, 1)

Return Value:

0




Function:

ATANH

Function Name:

Inverse hyperbolic tangent

Syntax:

ATANH(n)

Description:

Returns tanh-1(n), where –1 < n < 1, and tanh(n) is equivalent to the expression

(en – e-n )

(en + e-n )

Example Usage:

ATANH(.999999999)

Return Value:

10.73422678





Function:

COS

Function Name:

Cosine

Syntax:

COS(q)

Description:

Returns the cosine of an angle q, when q is specified in radians. The cosine of an angle is equivalent to the ratio base/hypotenuse, when a right triangle is formed using q (or the complement of q, as appropriate), and the intersection point of the angle q is taken to be the x, y coordinate (0, 0). Negative return values for COS apply for p/2 < q < 3p/2. Cosine is a periodic function with a period of 2p.

Example Usage:

COS(PI(0))

Return Value:

-1



Function:

COSH

Function Name:

Hyperbolic cosine

Syntax:

COSH(n)

Description:

Returns cosh(n), where cosh(n) is equivalent to the expression

(en + e-n )

2

Example Usage:

COSH(LN(VAR))

Return Value:

Result is equivalent to ½ * (VAR + 1 /VAR)

For example, if VAR = 2, result is 1.25




Function:

PI

Function Name:

Pi (p)

Syntax:

PI(0)

Description:

Returns the ratio p that defines the relationship between a circle’s circumference and its diameter, i.e., p = circumference / diameter.

An argument of 0 (zero) should always be specified for PI.

Example Usage:

PI(0)

Return Value:

3.141592654




Function:

SIN

Function Name:

Sine

Syntax:

SIN(q)

Description:

Returns the sine of an angle q, when q is specified in radians. The sine of an angle is equivalent to the ratio height/hypotenuse, when a right triangle is formed using q (or the complement of q, as appropriate), and the intersection point of the angle q is taken to be the x, y coordinate (0, 0). Negative return values for SIN apply for 0 < q < p. Sine is a periodic function with a period of 2p.

Example Usage:

SIN(PI(0)/2)

Return Value:

-1





Function:

SINH

Function Name:

Hyperbolic sine

Syntax:

SINH(n)

Description:

Returns sinh(n), where sinh(n) is equivalent to the expression

(en – e-n )

2

Example Usage:

SINH(LN(VAR))

Return Value:

Result is equivalent to ½ * (VAR - 1 / VAR)

For example, if VAR = 2, result is 0.75




Function:

TAN

Function Name:

Tangent

Syntax:

TAN(q)

Description:

Returns the tangent of an angle q, when q is specified in radians. The tangent of an angle is equivalent to the ratio height/base (or, alternatively, sin q / cos q), when a right triangle is formed using q (or the complement of q, as appropriate), and the intersection point of the angle q is taken to be the x, y coordinate (0, 0). Negative return values for TAN apply for 0 < q < p/2.

Tangent is a periodic, non-continuous function with a period of p; the non-continuity exists because there are asymptotes in the graph of tan q as q approaches p/2. From both the negative and positive side of q = p/2, tan q approaches infinity (¥). However, the CobolScript TAN function will return a large, arbitrary value for TAN(PI(0)/2) because of the finite size of the constant PI(0). Always keep this in mind when working with the CobolScript TAN function.

Example Usage:

TAN(PI(0)/2)

Return Value:

16331778728383844.0




Function:

TANH

Function Name:

Hyperbolic tangent

Syntax:

TANH(n)

Description:

Returns tanh(n), where tanh(n) is equivalent to the expression

(en – e-n )

(en + e-n )

Example Usage:

TANH(LN(2))

Return Value:

0.6