Trigonometric Functions: Tangents |
|
double tan(double x); long double tanl(long double x);
The tan() function calculates the tangent of a number. 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 tangent 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 Tangent = tan(Value); edtValue->Text = Tangent; } } //---------------------------------------------------------------------------
double atan(double x); The atan() function is used to calculate the arc tangent of a number.
The atan() function takes one argument, x, that represents the angle BA AC. After the evaluation, the function returns a double-precision number between –PI/2 and PI/2. If the number to be evaluated is larger than a double, use the atanl() function: long double atanl(long double x); This function takes a long double argument and returns a long double. |
Home | Copyright © 2004-2010 FunctionX, Inc. | |