diff --git a/doc/constants/constants.qbk b/doc/constants/constants.qbk index 3569bf36e..5ca17cb7b 100644 --- a/doc/constants/constants.qbk +++ b/doc/constants/constants.qbk @@ -318,6 +318,7 @@ This section lists the mathematical constants, their use(s) (and sometimes ratio [[quarter_pi] [[pi]/4] [0.78539816] [Equivalent to POSIX constant M_PI_4] ] [[sixth_pi] [[pi]/6] [0.523598] [] ] [[two_pi] [2[pi]] [6.28318] [Many uses, most simply, circumference of a circle]] +[[tau] [[tau]] [6.28318] [@https://en.wikipedia.org/wiki/Turn_(angle)#Tau_proposals Many uses, most simply, circumference of a circle. Equal to two_pi.]] [[two_thirds_pi] [2/3 [pi]] [2.09439] [[@http://en.wikipedia.org/wiki/Sphere#Volume_of_a_sphere volume of a hemi-sphere] = 4/3 [pi] r[cubed]]] [[three_quarters_pi] [3/4 [pi]] [2.35619] [ = 3/4 [pi] ]] [[four_thirds_pi] [4/3 [pi]] [4.18879] [[@http://en.wikipedia.org/wiki/Sphere#Volume_of_a_sphere volume of a sphere] = 4/3 [pi] r[cubed]]] diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 9d2c9e503..4ed08fb49 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -327,6 +327,9 @@ namespace boost{ namespace math BOOST_DEFINE_MATH_CONSTANT(laplace_limit, 0.662743419349181580974742097109252907056233549115022417, "0.66274341934918158097474209710925290705623354911502241752039253499097185308651127724965480259895818168") #endif +template +inline constexpr T tau() { return two_pi(); } + } // namespace constants } // namespace math } // namespace boost diff --git a/test/test_constants.cpp b/test/test_constants.cpp index 72ab2e19b..a107980f7 100644 --- a/test/test_constants.cpp +++ b/test/test_constants.cpp @@ -150,6 +150,7 @@ void test_spots(RealType) CHECK_ULP_CLOSE(3.14159265358979323846264338327950288419716939937510L/4, quarter_pi(), 2); CHECK_ULP_CLOSE(3.14159265358979323846264338327950288419716939937510L/6, sixth_pi(), 2); CHECK_ULP_CLOSE(2 * 3.14159265358979323846264338327950288419716939937510L, two_pi(), 2); + CHECK_ULP_CLOSE(2 * 3.14159265358979323846264338327950288419716939937510L, tau(), 2); CHECK_ULP_CLOSE(3 * 3.14159265358979323846264338327950288419716939937510L / 4, three_quarters_pi(), 2); CHECK_ULP_CLOSE(4 * 3.14159265358979323846264338327950288419716939937510L / 3, four_thirds_pi(), 2); CHECK_ULP_CLOSE(1 / (3.14159265358979323846264338327950288419716939937510L), one_div_pi(), 2);