Trigonometric Functions:
The Sine of a Value

double sin(double x);
long double sinl(long double x);

The sin() function calculates the sine of a number.

Consider AB the length of A to B, also called the hypotenuse to point A. Also consider CB the length of C to B, which is the opposite side to point A. The sine represents the ratio of CB/AB; that is, the ratio of the opposite side, CB over the hypotenuse AB.

The sin() function takes a double-precision number and returns one between 1 and 1. The sinl() function is used for 10-byte values.

Example: A form contains an Edit control named edtValue. After the user has typed a value and presses Enter, the OnKeyPress event retrieves the number typed in the edit box, calculates its sine and displays the result in the same Edit control:

void __fastcall TForm1::edtValueKeyPress(TObject *Sender, char &Key)
	if( Key == VK_RETURN )
		double Value = edtValue->Text.ToDouble();
		double Sinus = sin(Value);
		edtValue->Text = Sinus;


Home Copyright © 2004-2016, FunctionX, Inc.