Important

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see

# sin()

Return the sine of the argument.

## Syntax

``sin(radians)``

## Parameter

Parameter

Definition

`radians`

arc length in radians whose sine is to be determined

Valid Values

## Description

The sin() function returns the sine of radians. The output range for the sin() function is -1 ≤ sin() ≤ 1.

## Example

The following example prints a ta ble of the sin() function in the range 0 to 2π in increments of 30 degrees (instead of radians):

``````function main() {
PI = 3.141593;
print("SINE FUNCTION TEST\n\n");
print(" degrees calculated expected exact value\n");
print(" ------- ---------- -------- -----------\n");
# use a PSL list to hold the expected values (The printf
# statement will evaluate the elements containing sqrt
# expressions)
expected = [
0,0.5,0.5 * sqrt(3),
1,0.5 * sqrt(3),0.5,
0,-0.5,-0.5 * sqrt(3),
-1,-0.5 * sqrt(3),0.5,0
];
# Use a PSL List to hold the exact value strings
exact = [
" 0"," 0.5"," 0.5 * sqrt(3)",
" 1"," 0.5 * sqrt(3)"," 0.5",
" 0","-0.5","-0.5 * sqrt(3)",
"-1","-0.5 * sqrt(3)","-0.5"," 0"
];
increment = 0;
while (increment <= 360) {
printf(
" %3d %8.5f %8.5f %s\n",
increment,
sin(2 * PI * increment / 360),
trim(nthline(expected,int(1 + increment / 30)),"\n"),
trim(nthline(exact,int(1 + increment / 30)),"\n")
);
increment += 30;
}
return;
}``````

This example produces the following output:

``````SINE FUNCTION TEST
degrees calculated expected exact value
------- ---------- -------- -----------
0 0.00000 0.00000 0
30 0.50000 0.50000 0.5
60 0.86603 0.86603 0.5 * sqrt(3)
90 1.00000 1.00000 1
120 0.86603 0.86603 0.5 * sqrt(3)
150 0.50000 0.50000 0.5
180 0.00000 0.00000 0
210 -0.50000 -0.50000 -0.5
240 -0.86603 -0.86603 -0.5 * sqrt(3)
270 -1.00000 -1.00000 -1
300 -0.86603 -0.86603 -0.5 * sqrt(3)
330 -0.50000 0.50000 -0.5
360 0.00000 0.00000 0``````
Submitting... Thank you