diff --git a/src/FixedPoints/SFixed.h b/src/FixedPoints/SFixed.h index fcf1f7b..04ad53b 100644 --- a/src/FixedPoints/SFixed.h +++ b/src/FixedPoints/SFixed.h @@ -89,42 +89,17 @@ public: SFixed & operator /=(const SFixed & other); public: - const static SFixed Epsilon; - const static SFixed MinValue; - const static SFixed MaxValue; + constexpr const static SFixed Epsilon = SFixed::fromInternal(1); + constexpr const static SFixed MinValue = SFixed::fromInternal(FIXED_POINTS_DETAILS::MsbMask::Value); + constexpr const static SFixed MaxValue = SFixed::fromInternal(~FIXED_POINTS_DETAILS::MsbMask::Value); - const static SFixed Pi; - const static SFixed E; - const static SFixed Phi; - const static SFixed Tau; + // 40 digits is probably enough for these + constexpr const static SFixed Pi = 3.1415926535897932384626433832795028841971; + constexpr const static SFixed E = 2.718281828459045235360287471352662497757; + constexpr const static SFixed Phi = 1.6180339887498948482045868343656381177203; + constexpr const static SFixed Tau = 6.2831853071795864769252867665590057683943; }; -// -// Variables -// - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::Epsilon = SFixed::fromInternal(1); - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::MinValue = SFixed::fromInternal(FIXED_POINTS_DETAILS::MsbMask::Value); - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::MaxValue = SFixed::fromInternal(~FIXED_POINTS_DETAILS::MsbMask::Value); - -// 40 digits is probably enough for these -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::Pi = 3.1415926535897932384626433832795028841971; - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::E = 2.718281828459045235360287471352662497757; - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::Phi = 1.6180339887498948482045868343656381177203; - -template< unsigned Integer, unsigned Fraction > -constexpr const SFixed SFixed::Tau = 6.2831853071795864769252867665590057683943; - // // Free functions diff --git a/src/FixedPoints/UFixed.h b/src/FixedPoints/UFixed.h index 3615961..3becdf5 100644 --- a/src/FixedPoints/UFixed.h +++ b/src/FixedPoints/UFixed.h @@ -88,42 +88,17 @@ public: UFixed & operator /=(const UFixed & other); public: - const static UFixed Epsilon; - const static UFixed MinValue; - const static UFixed MaxValue; + constexpr const static UFixed Epsilon = UFixed::fromInternal(1); + constexpr const static UFixed MinValue = UFixed::fromInternal(0); + constexpr const static UFixed MaxValue = UFixed::fromInternal(~0); - const static UFixed Pi; - const static UFixed E; - const static UFixed Phi; - const static UFixed Tau; + // 40 digits is probably enough for these + constexpr const static UFixed Pi = 3.1415926535897932384626433832795028841971; + constexpr const static UFixed E = 2.718281828459045235360287471352662497757; + constexpr const static UFixed Phi = 1.6180339887498948482045868343656381177203; + constexpr const static UFixed Tau = 6.2831853071795864769252867665590057683943; }; -// -// Variables -// - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::Epsilon = UFixed::fromInternal(1); - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::MinValue = UFixed::fromInternal(0); - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::MaxValue = UFixed::fromInternal(~0); - -// 40 digits is probably enough for these -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::Pi = 3.1415926535897932384626433832795028841971; - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::E = 2.718281828459045235360287471352662497757; - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::Phi = 1.6180339887498948482045868343656381177203; - -template< unsigned Integer, unsigned Fraction > -constexpr const UFixed UFixed::Tau = 6.2831853071795864769252867665590057683943; - // // Free functions