diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 10:47:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-12 10:11:34 +0200 |
commit | 992a33313046f4a4d322db9464c474e7429a019a (patch) | |
tree | 494143e3070af872027ecaca840516d3101a881c /sal/rtl/math.cxx | |
parent | convert SwComparePosition to scoped enum (diff) | |
download | core-992a33313046f4a4d322db9464c474e7429a019a.tar.gz core-992a33313046f4a4d322db9464c474e7429a019a.zip |
clang-tidy: readability-else-after-return
run it against sal,cppu,cppuhelper
I had to run this multiple times to catch all the cases in each module,
and it requires some hand-tweaking of the resulting output - clang-tidy
is not very good about cleaning up trailing spaces, and aligning
things nicely.
Change-Id: I00336345f5f036e12422b98d66526509380c497a
Reviewed-on: https://gerrit.libreoffice.org/36194
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/rtl/math.cxx')
-rw-r--r-- | sal/rtl/math.cxx | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index 5dc94e0e0c1f..7eeeb85b4013 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -54,18 +54,16 @@ static double getN10Exp( int nExp ) // because -nExp = nExp if ( -nExp <= n10Count && -nExp > 0 ) return n10s[1][-nExp-1]; - else - return pow( 10.0, static_cast<double>( nExp ) ); + return pow( 10.0, static_cast<double>( nExp ) ); } - else if ( nExp > 0 ) + if ( nExp > 0 ) { if ( nExp <= n10Count ) return n10s[0][nExp-1]; - else - return pow( 10.0, static_cast<double>( nExp ) ); + return pow( 10.0, static_cast<double>( nExp ) ); } - else // ( nExp == 0 ) - return 1.0; + // ( nExp == 0 ) + return 1.0; } namespace { @@ -1144,21 +1142,19 @@ double SAL_CALL rtl_math_asinh( double fX ) SAL_THROW_EXTERN_C() { if ( fX == 0.0 ) return 0.0; - else + + double fSign = 1.0; + if ( fX < 0.0 ) { - double fSign = 1.0; - if ( fX < 0.0 ) - { - fX = - fX; - fSign = -1.0; - } - if ( fX < 0.125 ) - return fSign * rtl_math_log1p( fX + fX*fX / (1.0 + sqrt( 1.0 + fX*fX))); - else if ( fX < 1.25e7 ) - return fSign * log( fX + sqrt( 1.0 + fX*fX)); - else - return fSign * log( 2.0*fX); + fX = - fX; + fSign = -1.0; } + if ( fX < 0.125 ) + return fSign * rtl_math_log1p( fX + fX*fX / (1.0 + sqrt( 1.0 + fX*fX))); + if ( fX < 1.25e7 ) + return fSign * log( fX + sqrt( 1.0 + fX*fX)); + + return fSign * log( 2.0*fX); } /** improved accuracy of acosh for x large and for x near 1 @@ -1173,14 +1169,13 @@ double SAL_CALL rtl_math_acosh( double fX ) SAL_THROW_EXTERN_C() ::rtl::math::setNan( &fResult ); return fResult; } - else if ( fX == 1.0 ) + if ( fX == 1.0 ) return 0.0; - else if ( fX < 1.1 ) + if ( fX < 1.1 ) return rtl_math_log1p( fZ + sqrt( fZ*fZ + 2.0*fZ)); - else if ( fX < 1.25e7 ) + if ( fX < 1.25e7 ) return log( fX + sqrt( fX*fX - 1.0)); - else - return log( 2.0*fX); + return log( 2.0*fX); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |