@@ -14,14 +14,14 @@ namespace espp {
1414 * @param degrees Angle in degrees
1515 * @return Angle in radians
1616 */
17- [[maybe_unused]] static float deg_to_rad (float degrees) { return degrees * M_PI / 180 .0f ; }
17+ [[maybe_unused]] static float deg_to_rad (float degrees) { return degrees * ( float )( M_PI) / 180 .0f ; }
1818
1919/* *
2020 * @brief Convert radians to degrees
2121 * @param radians Angle in radians
2222 * @return Angle in degrees
2323 */
24- [[maybe_unused]] static float rad_to_deg (float radians) { return radians * 180 .0f / M_PI; }
24+ [[maybe_unused]] static float rad_to_deg (float radians) { return radians * 180 .0f / ( float )( M_PI) ; }
2525
2626/* *
2727 * @brief Simple square of the input.
@@ -125,7 +125,7 @@ template <typename T> int sgn(T x) { return (T(0) < x) - (x < T(0)); }
125125 * @param x Floating point value to be rounded.
126126 * @return Nearest integer to x.
127127 */
128- [[maybe_unused]] static int round (float x) { return (x > 0 ) ? (int )(x + 0.5 ) : (int )(x - 0.5 ); }
128+ [[maybe_unused]] static int round (float x) { return (x > 0 ) ? (int )(x + 0 .5f ) : (int )(x - 0 .5f ); }
129129
130130/* *
131131 * @brief fast natural log function, ln(x).
@@ -144,7 +144,7 @@ template <typename T> int sgn(T x) { return (T(0) < x) - (x < T(0)); }
144144 bx = 1065353216 | (bx & 8388607 );
145145 // x = * reinterpret_cast<float *>(&bx);
146146 memcpy (&x, &bx, sizeof (x));
147- return -1.49278 + (2.11263 + (-0.729104 + 0.10969 * x) * x) * x + 0.6931471806 * t;
147+ return -1 .49278f + (2 .11263f + (-0 .729104f + 0 .10969f * x) * x) * x + 0 .6931471806f * t;
148148}
149149
150150/* *
@@ -173,11 +173,11 @@ static constexpr int sine_array[200] = {
173173 * @return Approximation of sin(value)
174174 */
175175[[maybe_unused]] static float fast_sin (float angle) {
176- if (angle < M_PI_2) {
176+ if (angle < ( float )( M_PI_2) ) {
177177 return 0 .0001f * sine_array[round (126 .6873f * angle)];
178- } else if (angle < M_PI) {
178+ } else if (angle < ( float )( M_PI) ) {
179179 return 0 .0001f * sine_array[398 - round (126 .6873f * angle)];
180- } else if (angle < (3 .0f * M_PI_2)) {
180+ } else if (angle < (3 .0f * ( float )( M_PI_2) )) {
181181 return -0 .0001f * sine_array[round (126 .6873f * angle) - 398 ];
182182 } else {
183183 return -0 .0001f * sine_array[796 - round (126 .6873f * angle)];
@@ -191,8 +191,8 @@ static constexpr int sine_array[200] = {
191191 * @return Approximation of cos(value)
192192 */
193193[[maybe_unused]] static float fast_cos (float angle) {
194- float a_sin = angle + M_PI_2;
195- a_sin = (a_sin > (2 .0f * M_PI)) ? (a_sin - (2 .0f * M_PI)) : a_sin;
194+ float a_sin = angle + ( float )( M_PI_2) ;
195+ a_sin = (a_sin > (2 .0f * ( float )( M_PI))) ? (a_sin - (2 .0f * ( float )( M_PI) )) : a_sin;
196196 return fast_sin (a_sin);
197197}
198198} // namespace espp
0 commit comments