{{fbdoc item="title" value="COS"}}---- Returns the cosine of an angle {{fbdoc item="syntax"}}## [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Cos** ( [[KeyPgByval|byval]] //angle// [[KeyPgAs|as]] [[KeyPgDouble|double]] ) [[KeyPgAs|as]] [[KeyPgDouble|double]] ## {{fbdoc item="usage"}}## //result// = **Cos**( //angle// ) ## {{fbdoc item="param"}} ##//angle//## the angle (in radians) {{fbdoc item="ret"}} Returns the cosine of the argument ##//angle//## as a ##[[KeyPgDouble|Double]]## within the range of ##-1.0## to ##1.0##. {{fbdoc item="desc"}} The argument ##//number//## is measured in [[TutMathAngles|radians]] (not [[TutMathAngles|degrees]]). The value returned by this function is undefined for values of ##//angle//## with an absolute value of ##2 ^ 63## or greater. ##**Cos**## can be overloaded as operator to accept user-defined types. {{fbdoc item="ex"}} {{fbdoc item="filename" value="examples/manual/math/cos.bas"}}%%(freebasic) CONST PI AS DOUBLE = 3.1415926535897932 DIM a AS DOUBLE DIM r AS DOUBLE INPUT "Please enter an angle in degrees: ", a r = a * PI / 180 'Convert the degrees to Radians PRINT "" PRINT "The cosine of a" ; a; " degree angle is"; COS ( r ) SLEEP %% Output: %% Please enter an angle in degrees: 30 The cosine of a 30 degree angle Is 0.8660254037844387 %% {{fbdoc item="diff"}} - None {{fbdoc item="see"}} - ##[[KeyPgAcos|Acos]]## - ##[[KeyPgSin|Sin]]## - ##[[KeyPgTan|Tan]]## - [[TutMathIntroTrig|A Brief Introduction To Trigonometry]] {{fbdoc item="back" value="CatPgMath|Math"}}