From: Mikko Rasa Date: Tue, 5 Sep 2023 10:24:31 +0000 (+0300) Subject: Explicitly convert literals to the T type X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=deb72488567ad3b474a345825c0332548b404dd6;p=libs%2Fmath.git Explicitly convert literals to the T type Otherwise MSVC will complain about conversion to float when T is float. --- diff --git a/source/geometry/angle.h b/source/geometry/angle.h index c9d898c..c6baf1a 100644 --- a/source/geometry/angle.h +++ b/source/geometry/angle.h @@ -26,16 +26,16 @@ public: static Angle from_radians(T); static Angle from_turns(T); - static Angle zero() { return from_radians(0); } - static Angle right() { return from_turns(0.25); } + static Angle zero() { return from_radians(T(0)); } + static Angle right() { return from_turns(T(0.25)); } static Angle quarter_turn() { return right(); } - static Angle straight() { return from_turns(0.5); } + static Angle straight() { return from_turns(T(0.5)); } static Angle half_turn() { return straight(); } - static Angle full_turn() { return from_turns(1); } + static Angle full_turn() { return from_turns(T(1)); } - T degrees() const { return value*57.2957795130823208768; } + T degrees() const { return value*T(57.2957795130823208768); } T radians() const { return value; } - T turns() const { return value/6.28318530717958647692; } + T turns() const { return value/T(6.28318530717958647692); } Angle &operator+=(Angle); Angle &operator-=(Angle); @@ -155,7 +155,7 @@ inline T operator/(Angle a1, Angle a2) template inline Angle &Angle::wrap_with_base(Angle b) { - const T two_pi = 6.28318530717958647692; + const T two_pi = T(6.28318530717958647692); while(value=b.value+two_pi)