Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

SIN

Returns the sine of an angle.

Synopsis

SIN(number)

Arguments

number An expression that resolves to a number that expresses an angle in degrees.

Description

The SIN function takes an angle in degrees and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the hypotenuse, a value in the range -1 to 1 (inclusive).

To return results in radians, set $OPTIONS RADIANS.

To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.

Examples

The following example uses the SIN function to return the sine of an angle:

DIM MyAngle
MyAngle = 1.3;       ! Define angle in degrees.
PRINT SIN(MyAngle);  ! Return sine in radians.
Copy code to clipboard

The following example uses the SIN function to return the cosecant of an angle:

DIM MyAngle, MyCosecant
MyAngle = 1.3;                  ! Define angle in degrees.
MyCosecant = 1 / SIN(MyAngle);  ! Calculate cosecant.
PRINT MyCosecant
Copy code to clipboard

See Also