From 7bc96bd60fb4a11b1d29f8c0c91cbd3200c70131 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 1 May 2015 02:42:32 +1000 Subject: [PATCH] maths: explicitly instantiate PI for float, double --- maths.cpp | 5 +++++ test/maths.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/maths.cpp b/maths.cpp index 6ab5e70a..14084674 100644 --- a/maths.cpp +++ b/maths.cpp @@ -149,6 +149,11 @@ template uint32_t round_pow2 (uint32_t); template uint64_t round_pow2 (uint64_t); +//----------------------------------------------------------------------------- +template float PI; +template double PI; + + //----------------------------------------------------------------------------- // 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 diff --git a/test/maths.cpp b/test/maths.cpp index dfc34c79..d3721e91 100644 --- a/test/maths.cpp +++ b/test/maths.cpp @@ -114,8 +114,8 @@ main (int, char **) { CHECK_EQ (sign ( numeric_limits::infinity ()), 1); CHECK_EQ (sign (-numeric_limits::infinity ()), -1); - CHECK_EQ (to_degrees (PI), 180.0); CHECK_EQ (to_degrees (PI), 180.f); + CHECK_EQ (to_degrees (PI), 180.0); CHECK_EQ (to_radians (180.f), PI); CHECK_EQ (to_radians (180.0), PI);