How to get rid of minus sign from signed zero

前端 未结 6 544
心在旅途
心在旅途 2021-01-13 05:19

I am using asin to calculate the angle. The code is as below :

double FindAngle(const double theValue)
{
     return asin(theValue);
}

Find

6条回答
  •  半阙折子戏
    2021-01-13 06:06

    If you just want to convert -0 to 0 and leave other untouched, just do a comparison.

    double FindAngle(double value) {
        double res = asin(value);
        if (res == 0.0) res = 0.0;
        return res;
    }
    

提交回复
热议问题