summaryrefslogtreecommitdiffstatshomepage
path: root/lib/libm/math.c
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2020-04-13 20:56:31 +0200
committerDamien George <damien.p.george@gmail.com>2020-04-18 22:42:24 +1000
commit70affd9ba22e7f62666a9a2fafc2a3c0be9ef95a (patch)
tree068485d00339bf0b89a5b8ea328396ffa21a0b14 /lib/libm/math.c
parentbcf01d1686a8fa6d257daea25ce0d7df6e4ad839 (diff)
downloadmicropython-70affd9ba22e7f62666a9a2fafc2a3c0be9ef95a.tar.gz
micropython-70affd9ba22e7f62666a9a2fafc2a3c0be9ef95a.zip
all: Fix implicit floating point to integer conversions.
These are found when building with -Wfloat-conversion.
Diffstat (limited to 'lib/libm/math.c')
-rw-r--r--lib/libm/math.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libm/math.c b/lib/libm/math.c
index 2c52edd1be..3dfd925655 100644
--- a/lib/libm/math.c
+++ b/lib/libm/math.c
@@ -442,7 +442,7 @@ float expf(float x)
/* argument reduction */
if (hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */
if (hx > 0x3f851592) /* if |x| > 1.5 ln2 */
- k = invln2*x + half[sign];
+ k = (int)(invln2*x + half[sign]);
else
k = 1 - sign - sign;
hi = x - k*ln2hi; /* k*ln2hi is exact here */
@@ -533,7 +533,7 @@ float expm1f(float x)
k = -1;
}
} else {
- k = invln2*x + (sign ? -0.5f : 0.5f);
+ k = (int)(invln2*x + (sign ? -0.5f : 0.5f));
t = k;
hi = x - t*ln2_hi; /* t*ln2_hi is exact here */
lo = t*ln2_lo;