summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-15 12:34:12 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 16:54:19 +0200
commit6419ecb40a025f1b4f7df5d059bfca3579dab4d7 (patch)
tree6c54131d4a4f91d7247ae438d37b4b9f4734476d /tools
parent7b37af5af6afe75ad952538c145a4f4e61de9a96 (diff)
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 fd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135. Change-Id: I5b8e2a359374dd1500b149d74eba4c0b0e5cd8d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122115 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/poly.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 70bafc824404..ab33eb61021b 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -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));
}