summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorbuldi <dobrakowskirafal@gmail.com>2023-04-02 18:16:10 +0200
committerHossein <hossein@libreoffice.org>2023-04-24 00:52:19 +0200
commitc6755955aeaddb14bd3ad231f78cda47a0a5aeaa (patch)
treee25909665f662b110d7deb053a102be78159897f /editeng/source
parent14a23ef47c8ceaa1fc6dc4a7a942fb8360ea4bfd (diff)
tdf#147906 Use std::hypot for Pythagorean addition
Change-Id: I47611e1bffed814294bd2c7b23b26e1878151464 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149939 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/misc/txtrange.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 6374747be3c9..2f02a1150f91 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -192,11 +192,12 @@ tools::Long SvxBoundArgs::CalcMax( const Point& rPt1, const Point& rPt2,
}
else
nB = nStart;
- nB *= nB;
- nB += nDa * nDa;
- nB = sqrt( nB );
+
+ nB = std::hypot(nB, nDa);
+
if (nB == 0) // avoid div / 0
return 0;
+
nB = nRange + nDa * ( nFarRange - nRange ) / nB;
bool bNote;