From 466f86abb7208e853ad48ae46e97a2455667fa42 Mon Sep 17 00:00:00 2001 From: Liu Hao Date: Mon, 15 Aug 2022 18:07:07 +0800 Subject: tdf#148430 Use std math functions instead of rtl::math Change-Id: I6bcb33d51c3974d0e8905e1ffeac556a99870aab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138294 Tested-by: Jenkins Reviewed-by: Eike Rathke --- sal/qa/rtl/math/test-rtl-math.cxx | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'sal') diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx index ee4ae55a1a4b..69a54bd814ef 100644 --- a/sal/qa/rtl/math/test-rtl-math.cxx +++ b/sal/qa/rtl/math/test-rtl-math.cxx @@ -505,84 +505,84 @@ public: void test_erf() { double x, res; x = 0.0; - res = rtl::math::erf(x); + res = std::erf(x); CPPUNIT_ASSERT_EQUAL(0.0,res); rtl::math::setInf( &x, false); - res = rtl::math::erf(x); + res = std::erf(x); CPPUNIT_ASSERT_EQUAL(1.0,res); rtl::math::setInf( &x, true); - res = rtl::math::erf(x); + res = std::erf(x); CPPUNIT_ASSERT_EQUAL(-1.0,res); rtl::math::setNan( &x); - res = rtl::math::erf(x); + res = std::erf(x); CPPUNIT_ASSERT(std::isnan(res)); x = 3.0; - res = rtl::math::erf(-x); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -rtl::math::erf(x), res, 1E-12); + res = std::erf(-x); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -std::erf(x), res, 1E-12); } void test_erfc() { double x, res; x = 0.0; - res = rtl::math::erfc(x); + res = std::erfc(x); CPPUNIT_ASSERT_EQUAL(1.0,res); rtl::math::setInf( &x, false); - res = rtl::math::erfc(x); + res = std::erfc(x); CPPUNIT_ASSERT_EQUAL(0.0,res); rtl::math::setInf( &x, true); - res = rtl::math::erfc(x); + res = std::erfc(x); CPPUNIT_ASSERT_EQUAL(2.0,res); rtl::math::setNan( &x); - res = rtl::math::erfc(x); + res = std::erfc(x); CPPUNIT_ASSERT(std::isnan(res)); x = 3.0; - res = rtl::math::erfc(-x); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.0 - rtl::math::erfc(x), res, 1E-12); + res = std::erfc(-x); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.0 - std::erfc(x), res, 1E-12); } void test_expm1() { double x, res; x = 0.0; - res = rtl::math::expm1(x); + res = std::expm1(x); CPPUNIT_ASSERT_EQUAL(0.0,res); x = -0.0; - res = rtl::math::expm1(x); + res = std::expm1(x); CPPUNIT_ASSERT_EQUAL(-0.0,res); CPPUNIT_ASSERT(std::signbit(res)); rtl::math::setInf( &x, false); - res = rtl::math::expm1(x); + res = std::expm1(x); CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !std::signbit(res)); rtl::math::setInf( &x, true); - res = rtl::math::expm1(x); + res = std::expm1(x); CPPUNIT_ASSERT_EQUAL(-1.0,res); rtl::math::setNan( &x); - res = rtl::math::expm1(x); + res = std::expm1(x); CPPUNIT_ASSERT(std::isnan(res)); } void test_log1p() { double x, res; x = 0.0; - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT_EQUAL(0.0,res); x = -0.0; - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT_EQUAL(-0.0,res); CPPUNIT_ASSERT(std::signbit(res)); rtl::math::setInf( &x, false); - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && !std::signbit(res)); x = -1.0; - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT_EQUAL(true, std::isinf(res) && std::signbit(res)); x = -1.1; - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT(std::isnan(res)); rtl::math::setInf( &x, true); - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT(std::isnan(res)); rtl::math::setNan( &x); - res = rtl::math::log1p(x); + res = std::log1p(x); CPPUNIT_ASSERT(std::isnan(res)); } @@ -636,20 +636,20 @@ public: void test_atanh() { double res; - res = rtl::math::atanh(-2.0); // NaN + res = std::atanh(-2.0); // NaN CPPUNIT_ASSERT(std::isnan(res)); - res = rtl::math::atanh(-1.0); // -Inf + res = std::atanh(-1.0); // -Inf CPPUNIT_ASSERT(std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); - CPPUNIT_ASSERT_EQUAL(0.0, rtl::math::atanh(0.0)); + CPPUNIT_ASSERT_EQUAL(0.0, std::atanh(0.0)); - res = rtl::math::atanh(1.0); // +Inf + res = std::atanh(1.0); // +Inf CPPUNIT_ASSERT(!std::signbit(res)); CPPUNIT_ASSERT(std::isinf(res)); - res = rtl::math::atanh(2.0); // NaN + res = std::atanh(2.0); // NaN CPPUNIT_ASSERT(std::isnan(res)); } -- cgit v1.2.3