Java Math.cos(Math.toRadians()) returns weird values

前端 未结 4 1479
死守一世寂寞
死守一世寂寞 2020-12-03 20:25

I\'ve got a little Problem with the Math.cos() method. I know, I have to convert the angle to Radians before using Math.cos(). But if I just do:

4条回答
  •  情歌与酒
    2020-12-03 21:20

    The value is very close to the correct result. It seems like a loss of precision in the floating point operations of transforming degrees to radians.

提交回复
热议问题