From a6f0cccae2f35fea47e19df24736e0b69d7abab4 Mon Sep 17 00:00:00 2001 From: Juan Hernando Date: Mon, 27 Feb 2023 16:59:55 +0100 Subject: [PATCH] Use more decimals for Pi in angle conversions The previous value had twelve signficant digits which is quite below the maximum precision of double floating numbers. In this change the value returned by Python for the expression math.pi * 2 is used. This value is the same returned by std::cos(-1) * 2 with 16 significant digits. --- include/boost/units/base_units/angle/degree.hpp | 2 +- include/boost/units/base_units/angle/gradian.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/units/base_units/angle/degree.hpp b/include/boost/units/base_units/angle/degree.hpp index 63edb70e..73113b9a 100644 --- a/include/boost/units/base_units/angle/degree.hpp +++ b/include/boost/units/base_units/angle/degree.hpp @@ -14,7 +14,7 @@ #include #include -BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",6.28318530718/360.,boost::units::angle::radian_base_unit,-101); +BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,degree,"degree","deg",6.283185307179586/360.,boost::units::angle::radian_base_unit,-101); #if BOOST_UNITS_HAS_BOOST_TYPEOF diff --git a/include/boost/units/base_units/angle/gradian.hpp b/include/boost/units/base_units/angle/gradian.hpp index 7b291b46..01aacc55 100644 --- a/include/boost/units/base_units/angle/gradian.hpp +++ b/include/boost/units/base_units/angle/gradian.hpp @@ -14,7 +14,7 @@ #include #include -BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",6.28318530718/400.,boost::units::angle::radian_base_unit,-102); +BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(angle,gradian,"gradian","grad",6.283185307179586/400.,boost::units::angle::radian_base_unit,-102); #if BOOST_UNITS_HAS_BOOST_TYPEOF