Cos(90) returning a value very close to 0, but I need 0?

后端 未结 5 896
旧时难觅i
旧时难觅i 2021-01-07 04:00

The values for temp_x_btm_left = 0 & temp_y_btm_left=1;

angle = 90;

//Moving the bottom left coordinates
_btm_left.real() = (temp_x_btm_left * cos(angle         


        
5条回答
  •  走了就别回头了
    2021-01-07 04:08

    One solution would be to set up an Epsilon equal to some magical small value and then check whether the absolute value of your result provided by a function is less (or less-or-equal) to your Epsilon.

    (Naming it Epsilon is just a convention; it could be double MagicalNumberIndeed = VerySmallValue;)

提交回复
热议问题