Returns the cosine of an angle, in radians.
Cos(number)
Parameter |
Description |
---|---|
number |
Angle, in radians, for which you want the cosine |
The range of the result is -1 to 1.
To convert degrees to radians, multiply degrees by π/180. To convert radians to degrees, multiply radians by 180/π.
<!--- This snippet shows how to use Cos ---> <html> <head> <title>Cos Example</title> </head> <body bgcolor = silver> <H3>Cos Example</H3> <!--- output its Cos value ---> <cfif IsDefined("FORM.CosNum")> <cfif IsNumeric(#FORM.CosNum#)> Cos(<cfoutput>#FORM.CosNum#</cfoutput>) = <cfoutput>#Cos(FORM.cosNum)# radians = #Evaluate(Cos(FORM.cosNum) * 180/PI())# Degrees</cfoutput> <cfelse> <!--- if it is empty, output an error message ---> <H4>Please enter a number between -1 and 1</H4> </cfif> </cfif> <form action = "cos.cfm" method = "POST"> <P>Type in a number to get its cosine in Radians and Degrees <BR><input type = "Text" name = "cosNum" size = "25"> <P><input type = "Submit" name = ""> <input type = "RESET"> </FORM> </body> </html>