[Libreoffice-commits] core.git: chart2/source drawinglayer/source scaddins/source sc/source

BaiXiaochun (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 3 19:58:02 UTC 2021


 chart2/source/tools/RelativePositionHelper.cxx             |    4 
 chart2/source/view/main/LabelPositionHelper.cxx            |  171 ++++++-------
 chart2/source/view/main/PlottingPositionHelper.cxx         |    4 
 chart2/source/view/main/ShapeFactory.cxx                   |    8 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |    5 
 sc/source/core/data/documen4.cxx                           |    2 
 scaddins/source/analysis/bessel.cxx                        |   10 
 7 files changed, 104 insertions(+), 100 deletions(-)

New commits:
commit 3128fd02c069765a4428022e84a324e991c69521
Author:     BaiXiaochun <bai.xiaochun.mofan at protonmail.com>
AuthorDate: Wed Jun 30 18:12:08 2021 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Sat Jul 3 21:57:29 2021 +0200

    Purge out when safe rtl::math ( isValidArcArg / sin / cos  )
    
    /** If a value is a valid argument for sin(), cos(), tan().
    IEEE 754 specifies that absolute values up to 2^64 (=1.844e19) for the
    radian must be supported by trigonometric functions.  Unfortunately, at
    least on x86 architectures, the FPU doesn't generate an error pattern for
    values >2^64 but produces erroneous results instead and sets only the
    "invalid operation" (IM) flag in the status word :-(  Thus the application
    has to handle it itself.
    */
    
    chart2/source/tools/RelativePositionHelper.cxx
    Function name: RelativePositionHelper::getCenterOfAnchoredObject
    From here: suppose it's related to the orientation of the chart << 2^64
    
    chart2/source/view/main/LabelPositionHelper.cxx
    LabelPositionHelper::LabelPositionHelper
    Suppose: setup label position.
    There won't be angles grater than 360º.
    
    chart2/source/view/main/PlottingPositionHelper.cxx
    PolarPlottingPositionHelper::transformUnitCircleToScene
    Suppose: maybe disc chart orientation?
    Internal angle should be safe.
    
    chart2/source/view/main/ShapeFactory.cxx
    ShapeFactory::getSizeAfterRotation
    Suppose: rotate shape
    Internal angle should be safe.
    
    drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
    Constant 100% safe
    
    sc/source/core/data/documen4.cxx
    bool ScDocument::Solver
    Suppose: the tangent is being used as numerical derivative (Regula falsi algorithm)
    So no impossible angles
    
    scaddins/source/analysis/bessel.cxx
    Filtered it out as bad imput
    
    Change-Id: Ib348cca6ce13263d087b6731f93f58d8a15cc725
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118193
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx
index deb3e5ca5a2c..260888e907dd 100644
--- a/chart2/source/tools/RelativePositionHelper.cxx
+++ b/chart2/source/tools/RelativePositionHelper.cxx
@@ -237,9 +237,9 @@ awt::Point RelativePositionHelper::getCenterOfAnchoredObject(
 
     //take rotation into account:
     aResult.X += static_cast< sal_Int32 >(
-        ::rtl::math::round(    fXDelta * rtl::math::cos( fAnglePi ) + fYDelta * rtl::math::sin( fAnglePi ) ) );
+        ::rtl::math::round(    fXDelta * std::cos( fAnglePi ) + fYDelta * std::sin( fAnglePi ) ) );
     aResult.Y += static_cast< sal_Int32 >(
-        ::rtl::math::round(  - fXDelta * rtl::math::sin( fAnglePi ) + fYDelta * rtl::math::cos( fAnglePi ) ) );
+        ::rtl::math::round(  - fXDelta * std::sin( fAnglePi ) + fYDelta * std::cos( fAnglePi ) ) );
 
     return aResult;
 }
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx
index 74fd1ed78174..798c6562e1f6 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -25,7 +25,8 @@
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
-#include <rtl/math.hxx>
+
+#include <cmath>
 
 namespace chart
 {
@@ -123,36 +124,36 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+        rfXCorrection = -aSize.Height*std::sin( fAnglePi )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+            rfYCorrection = -aSize.Width*std::sin( fAnglePi )/2.0;
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = -aSize.Width *rtl::math::sin( beta )
-            -aSize.Height *rtl::math::cos( beta )/2.0;
+        rfXCorrection = -aSize.Width *std::sin( beta )
+            -aSize.Height *std::cos( beta )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+            rfYCorrection = -aSize.Width *std::cos( beta )/2.0;
         else
-            rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+            rfYCorrection = -aSize.Width *std::cos( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = fAnglePi - F_PI;
-        rfXCorrection = -aSize.Width *rtl::math::cos( beta )
-            -aSize.Height*rtl::math::sin( beta )/2.0;
+        rfXCorrection = -aSize.Width *std::cos( beta )
+            -aSize.Height*std::sin( beta )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+            rfYCorrection = aSize.Width *std::sin( beta )/2.0;
         else
-            rfYCorrection = aSize.Width *rtl::math::sin( beta );
+            rfYCorrection = aSize.Width *std::sin( beta );
     }
     else
     {
         double beta = 2*F_PI - fAnglePi;
-        rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
+        rfXCorrection = -aSize.Height*std::sin( beta )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+            rfYCorrection = aSize.Width*std::sin( beta )/2.0;
     }
 }
 
@@ -166,35 +167,35 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+        rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+            rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = F_PI - fAnglePi;
-        rfXCorrection = aSize.Width *rtl::math::cos( beta )
-            + aSize.Height*rtl::math::sin( beta )/2.0;
+        rfXCorrection = aSize.Width *std::cos( beta )
+            + aSize.Height*std::sin( beta )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+            rfYCorrection = aSize.Width *std::sin( beta )/2.0;
         else
-            rfYCorrection = aSize.Width *rtl::math::sin( beta );
+            rfYCorrection = aSize.Width *std::sin( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = aSize.Width *rtl::math::sin( beta )
-                    +aSize.Height*rtl::math::cos( beta )/2.0;
+        rfXCorrection = aSize.Width *std::sin( beta )
+                    +aSize.Height*std::cos( beta )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+            rfYCorrection = -aSize.Width *std::cos( beta )/2.0;
         else
-            rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+            rfYCorrection = -aSize.Width *std::cos( beta );
     }
     else
     {
-        rfXCorrection  = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+        rfXCorrection  = aSize.Height*std::sin( 2*F_PI - fAnglePi )/2.0;
         if( bRotateAroundCenter )
-            rfYCorrection = -aSize.Width*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+            rfYCorrection = -aSize.Width*std::sin( 2*F_PI - fAnglePi )/2.0;
     }
 }
 
@@ -208,35 +209,35 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+        rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection += aSize.Width*rtl::math::cos( fAnglePi )/2.0;
-        rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+            rfXCorrection += aSize.Width*std::cos( fAnglePi )/2.0;
+        rfYCorrection = -aSize.Width*std::sin( fAnglePi )/2.0;
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi - F_PI2;
-        rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+        rfXCorrection = aSize.Height*std::cos( beta )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection -= aSize.Width*rtl::math::sin( beta )/2.0;
-        rfYCorrection = -aSize.Width*rtl::math::cos( beta )/2.0
-            - aSize.Height*rtl::math::sin( beta );
+            rfXCorrection -= aSize.Width*std::sin( beta )/2.0;
+        rfYCorrection = -aSize.Width*std::cos( beta )/2.0
+            - aSize.Height*std::sin( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = fAnglePi - F_PI;
-        rfXCorrection = -aSize.Height *rtl::math::sin( beta )/2.0;
+        rfXCorrection = -aSize.Height *std::sin( beta )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection += aSize.Width *rtl::math::cos( beta )/2.0;
-        rfYCorrection = -aSize.Width *rtl::math::sin( beta )/2.0
-            -aSize.Height *rtl::math::cos( beta );
+            rfXCorrection += aSize.Width *std::cos( beta )/2.0;
+        rfYCorrection = -aSize.Width *std::sin( beta )/2.0
+            -aSize.Height *std::cos( beta );
     }
     else
     {
-        rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+        rfXCorrection = aSize.Height*std::sin( fAnglePi )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection -= aSize.Width*rtl::math::cos( fAnglePi )/2.0;
-        rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+            rfXCorrection -= aSize.Width*std::cos( fAnglePi )/2.0;
+        rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
     }
 }
 
@@ -250,36 +251,36 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+        rfXCorrection = -aSize.Height*std::sin( fAnglePi )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection -= aSize.Width *rtl::math::cos( fAnglePi )/2.0;
-        rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+            rfXCorrection -= aSize.Width *std::cos( fAnglePi )/2.0;
+        rfYCorrection = aSize.Width*std::sin( fAnglePi )/2.0;
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0;
+        rfXCorrection = -aSize.Height*std::cos( beta )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection += aSize.Width *rtl::math::sin( beta )/2.0;
-        rfYCorrection = aSize.Width *rtl::math::cos( beta )/2.0
-            +aSize.Height*rtl::math::sin( beta );
+            rfXCorrection += aSize.Width *std::sin( beta )/2.0;
+        rfYCorrection = aSize.Width *std::cos( beta )/2.0
+            +aSize.Height*std::sin( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+        rfXCorrection = aSize.Height*std::cos( beta )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection -= aSize.Width *rtl::math::sin( beta )/2.0;
-        rfYCorrection = aSize.Height*rtl::math::sin( beta )
-                        +aSize.Width*rtl::math::cos( beta )/2.0;
+            rfXCorrection -= aSize.Width *std::sin( beta )/2.0;
+        rfYCorrection = aSize.Height*std::sin( beta )
+                        +aSize.Width*std::cos( beta )/2.0;
     }
     else
     {
         double beta = 2*F_PI - fAnglePi;
-        rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+        rfXCorrection = aSize.Height*std::sin( beta )/2.0;
         if( !bRotateAroundCenter )
-            rfXCorrection += aSize.Width*rtl::math::cos( beta )/2.0;
-        rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+            rfXCorrection += aSize.Width*std::cos( beta )/2.0;
+        rfYCorrection = aSize.Width*std::sin( beta )/2.0;
     }
 }
 
@@ -293,25 +294,25 @@ void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+        rfYCorrection = -aSize.Width*std::sin( fAnglePi );
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = -aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = -aSize.Height*rtl::math::sin( beta )
-                        -aSize.Width*rtl::math::cos( beta );
+        rfXCorrection = -aSize.Width*std::sin( beta );
+        rfYCorrection = -aSize.Height*std::sin( beta )
+                        -aSize.Width*std::cos( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = -aSize.Height*rtl::math::cos( beta )
-                        -aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = -aSize.Height*std::cos( beta )
+                        -aSize.Width*std::sin( beta );
+        rfYCorrection = -aSize.Height*std::sin( beta );
     }
     else
     {
-        rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+        rfXCorrection = aSize.Height*std::sin( fAnglePi );
     }
 }
 
@@ -325,25 +326,25 @@ void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrecti
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+        rfXCorrection = -aSize.Height*std::sin( fAnglePi );
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = -aSize.Width*rtl::math::sin( beta )
-                        -aSize.Height*rtl::math::cos( beta );
-        rfYCorrection = aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = -aSize.Width*std::sin( beta )
+                        -aSize.Height*std::cos( beta );
+        rfYCorrection = aSize.Height*std::sin( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = -aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = aSize.Width*rtl::math::cos( beta )
-                        +aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = -aSize.Width*std::sin( beta );
+        rfYCorrection = aSize.Width*std::cos( beta )
+                        +aSize.Height*std::sin( beta );
     }
     else
     {
-        rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+        rfYCorrection = -aSize.Width*std::sin( fAnglePi );
     }
 }
 
@@ -357,25 +358,25 @@ void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+        rfXCorrection = aSize.Height*std::sin( fAnglePi );
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = aSize.Width*rtl::math::sin( beta )
-                        +aSize.Height*rtl::math::cos( beta );
-        rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = aSize.Width*std::sin( beta )
+                        +aSize.Height*std::cos( beta );
+        rfYCorrection = -aSize.Height*std::sin( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = -aSize.Width*rtl::math::cos( beta )
-                        -aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = aSize.Width*std::sin( beta );
+        rfYCorrection = -aSize.Width*std::cos( beta )
+                        -aSize.Height*std::sin( beta );
     }
     else
     {
-        rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+        rfYCorrection = aSize.Width*std::sin( fAnglePi );
     }
 }
 
@@ -389,25 +390,25 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect
     }
     else if( fAnglePositiveDegree<= 90.0 )
     {
-        rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+        rfYCorrection = aSize.Width*std::sin( fAnglePi );
     }
     else if( fAnglePositiveDegree<= 180.0 )
     {
         double beta = fAnglePi-F_PI2;
-        rfXCorrection = aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = aSize.Height*rtl::math::sin( beta )
-                        +aSize.Width*rtl::math::cos( beta );
+        rfXCorrection = aSize.Width*std::sin( beta );
+        rfYCorrection = aSize.Height*std::sin( beta )
+                        +aSize.Width*std::cos( beta );
     }
     else if( fAnglePositiveDegree<= 270.0 )
     {
         double beta = 3*F_PI2 - fAnglePi;
-        rfXCorrection = aSize.Height*rtl::math::cos( beta )
-                        +aSize.Width*rtl::math::sin( beta );
-        rfYCorrection = aSize.Height*rtl::math::sin( beta );
+        rfXCorrection = aSize.Height*std::cos( beta )
+                        +aSize.Width*std::sin( beta );
+        rfYCorrection = aSize.Height*std::sin( beta );
     }
     else
     {
-        rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+        rfXCorrection = -aSize.Height*std::sin( fAnglePi );
     }
 }
 
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index b8e9431ae2ab..69a346b067e3 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -615,8 +615,8 @@ drawing::Position3D PolarPlottingPositionHelper::transformUnitCircleToScene( dou
 {
     double fAnglePi = basegfx::deg2rad(fUnitAngleDegree);
 
-    double fX=fUnitRadius*rtl::math::cos(fAnglePi);
-    double fY=fUnitRadius*rtl::math::sin(fAnglePi);
+    double fX=fUnitRadius*std::cos(fAnglePi);
+    double fY=fUnitRadius*std::sin(fAnglePi);
     double fZ=fLogicZ;
 
     //!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 5b7c4859beb8..5f2cfb442820 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2632,11 +2632,11 @@ awt::Size ShapeFactory::getSizeAfterRotation(
             const double fAnglePi = basegfx::deg2rad(fRotationAngleDegree);
 
             aRet.Height = static_cast<sal_Int32>(
-                aSize.Width*rtl::math::sin( fAnglePi )
-                + aSize.Height*rtl::math::cos( fAnglePi ));
+                aSize.Width*std::sin( fAnglePi )
+                + aSize.Height*std::cos( fAnglePi ));
             aRet.Width = static_cast<sal_Int32>(
-                aSize.Width*rtl::math::cos( fAnglePi )
-                + aSize.Height*rtl::math::sin( fAnglePi ));
+                aSize.Width*std::cos( fAnglePi )
+                + aSize.Height*std::sin( fAnglePi ));
         }
     }
     return aRet;
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 8837354fc706..f08d17f2f002 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -17,11 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <cmath>
 #include <memory>
 #include "vclmetafileprocessor2d.hxx"
 #include "vclpixelprocessor2d.hxx"
 #include <rtl/ustring.hxx>
-#include <rtl/math.hxx>
 #include <tools/gen.hxx>
 #include <tools/stream.hxx>
 #include <tools/diagnose_ex.h>
@@ -443,7 +443,8 @@ std::unique_ptr<SvtGraphicStroke> VclMetafileProcessor2D::impTryToCreateSvtGraph
                 {
                     eJoin = SvtGraphicStroke::joinMiter;
                     // ATM 15 degrees is assumed
-                    fMiterLength /= rtl::math::sin(basegfx::deg2rad(15.0));
+                    // TODO wait for P1383R0 and C++20's std::numbers::pi
+                    fMiterLength /= std::sin(M_PI / 12);
                     break;
                 }
                 case basegfx::B2DLineJoin::Round:
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index aee431660d0a..aa3b6f69f74d 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -153,7 +153,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
                     while ( !bDoneHorMove && !bHorMoveError && nHorIter++ < nHorMaxIter )
                     {
                         double fHorAngle = fHorStepAngle * static_cast<double>( nHorIter );
-                        double fHorTangent = ::rtl::math::tan(basegfx::deg2rad(fHorAngle));
+                        double fHorTangent = std::tan(basegfx::deg2rad(fHorAngle));
 
                         sal_uInt16 nIdx = 0;
                         while( nIdx++ < 2 && !bDoneHorMove )
diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx
index bb6023a4f2f9..b356dc219e44 100644
--- a/scaddins/source/analysis/bessel.cxx
+++ b/scaddins/source/analysis/bessel.cxx
@@ -325,12 +325,13 @@ double BesselK( double fNum, sal_Int32 nOrder )
 /// @throws NoConvergenceException
 static double Bessely0( double fX )
 {
-    if (fX <= 0)
+    // If fX > 2^64 then sin and cos fail
+    if (fX <= 0 || !rtl::math::isValidArcArg(fX))
         throw IllegalArgumentException();
     const double fMaxIteration = 9000000.0; // should not be reached
     if (fX > 5.0e+6) // iteration is not considerable better then approximation
         return sqrt(1/f_PI/fX)
-                *(rtl::math::sin(fX)-rtl::math::cos(fX));
+                *(std::sin(fX)-std::cos(fX));
     const double epsilon = 1.0e-15;
     const double EulerGamma = 0.57721566490153286060;
     double alpha = log(fX/2.0)+EulerGamma;
@@ -378,12 +379,13 @@ static double Bessely0( double fX )
 /// @throws NoConvergenceException
 static double Bessely1( double fX )
 {
-    if (fX <= 0)
+    // If fX > 2^64 then sin and cos fail
+    if (fX <= 0 || !rtl::math::isValidArcArg(fX))
         throw IllegalArgumentException();
     const double fMaxIteration = 9000000.0; // should not be reached
     if (fX > 5.0e+6) // iteration is not considerable better then approximation
         return - sqrt(1/f_PI/fX)
-                *(rtl::math::sin(fX)+rtl::math::cos(fX));
+                *(std::sin(fX)+std::cos(fX));
     const double epsilon = 1.0e-15;
     const double EulerGamma = 0.57721566490153286060;
     double alpha = 1.0/fX;


More information about the Libreoffice-commits mailing list