No need to check if nDX is 0 for atan2

We rely on IEEE floating-point arithmetic anyway, and then even both
arguments equal to 0 do not result in an error.

Even if it was different, it would be better to check id both nDX and
nDY are 0, and return 0 early.

It was so ever since "MWS_SRX644: migrate branch mws_srx644 -> HEAD"
commit fd2cf3dc7c.

Change-Id: I5b8e2a359374dd1500b149d74eba4c0b0e5cd8d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122115
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2021-09-15 16:54:19 +02:00
parent 7b37af5af6
commit 6419ecb40a
+1 -1
View File
@@ -58,7 +58,7 @@ static double ImplGetParameter( const Point& rCenter, const Point& rPt, double f
{
const double nDX = static_cast<double>(rPt.X()) - rCenter.X();
const double nDY = static_cast<double>(rCenter.Y()) - rPt.Y();
double fAngle = atan2(nDY, (nDX == 0) ? 0.000000001 : nDX);
double fAngle = atan2(nDY, nDX);
return atan2(fWR*sin(fAngle), fHR*cos(fAngle));
}