maths: explicitly instantiate PI for float, double

This commit is contained in:
Danny Robson 2015-05-01 02:42:32 +10:00
parent bb1e87bb47
commit 7bc96bd60f
2 changed files with 6 additions and 1 deletions

View File

@ -149,6 +149,11 @@ template uint32_t round_pow2 (uint32_t);
template uint64_t round_pow2 (uint64_t); template uint64_t round_pow2 (uint64_t);
//-----------------------------------------------------------------------------
template float PI<float>;
template double PI<double>;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Simple instantiations. Some functions aren't used internally to the library // Simple instantiations. Some functions aren't used internally to the library
// so it's easier to instantiate early and check for broken code at library // so it's easier to instantiate early and check for broken code at library

View File

@ -114,8 +114,8 @@ main (int, char **) {
CHECK_EQ (sign ( numeric_limits<double>::infinity ()), 1); CHECK_EQ (sign ( numeric_limits<double>::infinity ()), 1);
CHECK_EQ (sign (-numeric_limits<double>::infinity ()), -1); CHECK_EQ (sign (-numeric_limits<double>::infinity ()), -1);
CHECK_EQ (to_degrees (PI<double>), 180.0);
CHECK_EQ (to_degrees (PI<float>), 180.f); CHECK_EQ (to_degrees (PI<float>), 180.f);
CHECK_EQ (to_degrees (PI<double>), 180.0);
CHECK_EQ (to_radians (180.f), PI<float>); CHECK_EQ (to_radians (180.f), PI<float>);
CHECK_EQ (to_radians (180.0), PI<double>); CHECK_EQ (to_radians (180.0), PI<double>);