From 3b7f96f9822f8d5dd2c3120ae00d3e6d862843dd Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sun, 16 Jun 2019 13:46:19 -0500 Subject: [PATCH] Add explicit cast in fix16_from_dbl() This fixes the error: implicit conversion from 'float' to 'double' to match other operand of binary expression When the compiler options -fsingle-precision-constant -Wdouble-promotion are set --- libfixmath/fix16.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfixmath/fix16.h b/libfixmath/fix16.h index 8c5e9da..644776b 100644 --- a/libfixmath/fix16.h +++ b/libfixmath/fix16.h @@ -70,7 +70,7 @@ static inline fix16_t fix16_from_dbl(double a) { double temp = a * fix16_one; #ifndef FIXMATH_NO_ROUNDING - temp += (temp >= 0) ? 0.5f : -0.5f; + temp += (double)((temp >= 0) ? 0.5f : -0.5f); #endif return (fix16_t)temp; }