xHarbour Reference Documentation > Function Reference |
Calculates the cosine for an angle.
Cos( <nAngle> ) --> nCosine
The function returns the cosine of an angle in the range between -1 and +1.
See also: | CosH(), Cot(), DtoR(), RtoD(), SetPrec(), Sin(), Tan() |
Category: | CT:Math , Mathematical functions , Trigonometric functions |
Source: | ct\trig.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays results of function Cos(). PROCEDURE Main ? Str( Cos( -Pi()*1.0 ), 18, 15) // result: -1.000000000000000 ? Str( Cos( -Pi()*0.5 ), 18, 15) // result: 0.000000000000000 ? Str( Cos( -Pi()*0.3 ), 18, 15) // result: 0.587785252292473 ? Str( Cos( Pi()*0.0 ), 18, 15) // result: 1.000000000000000 ? Str( Cos( Pi()*0.3 ), 18, 15) // result: 0.587785252292473 ? Str( Cos( Pi()*0.5 ), 18, 15) // result: 0.000000000000000 ? Str( Cos( Pi()*1.0 ), 18, 15) // result: -1.000000000000000 RETURN
http://www.xHarbour.com