# Why do I get wrong values when I use the sin and cos functions?

• 02-29-2004
Marcos
Why do I get wrong values when I use the sin and cos functions?
Like if I I put
Code:

`double a = cos(45);`
I get that a = .525322 when a should be = 7.07106. This happens with all thease kinds of funtions, whats happening?
• 02-29-2004
BoredCrzy
a = .525322 because the function cos takes in radians rather than degrees (which should be .707106, not 7.07106)
• 02-29-2004
MrWizard
Those functions take radians not degrees.
• 02-29-2004
Marcos
duh! of course haha, Thanks a lot for the help guys :)
• 02-29-2004
Marcos
oh and... so... like if I want to put cos(45°) (the degrees that you need 360 for a circle) how would I do it? :confused:
• 02-29-2004
joshdick
You could write wrapper functions that do the conversions so that when you call them, you can always do it in degrees.
• 02-29-2004
BoredCrzy
As Joshdick mentioned, write a wrapper function that converts the degree measure into radians (degree * PI/180)

e.g.

Code:

```double sin_d (double degrees) {     return (sin(degrees * 3.1416/180)); }```