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

后端 未结 5 894
旧时难觅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:13

    The "magical epsilon" referred to in previous answers is actually provided by the language via

     #include 
     std::numeric_limits::epsilon();
    

    and

     std::numeric_limits::epsilon();
    

    which is "the difference between 1 and the least value greater than 1 that is representable"

提交回复
热议问题