cos returns wrong values?

前端 未结 3 793
一整个雨季
一整个雨季 2020-12-07 04:13

I have a strange problem with the standard cos function of cmath/math.h. Apparently under some circumstances it returns a wrong or simply undefined value.

#i         


        
3条回答
  •  春和景丽
    2020-12-07 04:40

    cos expects radians, you are giving it degrees. Multiply your input value by 3.14159/180, and you will get the right answer.

提交回复
热议问题