Skip to content

Commit bcf01d1

Browse files
stinosdpgeorge
authored andcommitted
all: Fix implicit conversion from double to float.
These are found when building with -Wfloat-conversion.
1 parent dc4d119 commit bcf01d1

File tree

23 files changed

+266
-265
lines changed

23 files changed

+266
-265
lines changed

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
362362
case FLOAT32:
363363
return mp_obj_new_float_from_f(((float *)p)[index]);
364364
case FLOAT64:
365-
return mp_obj_new_float(((double *)p)[index]);
365+
return mp_obj_new_float_from_d(((double *)p)[index]);
366366
#endif
367367
default:
368368
assert(0);

lib/libm/asinfacosf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323

2424
// dpgeorge: pio2 was double in original implementation of asinf
2525
static const float
26-
pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */
27-
pio2_lo = 7.5497894159e-08; /* 0x33a22168 */
26+
pio2_hi = 1.5707962513e+00f, /* 0x3fc90fda */
27+
pio2_lo = 7.5497894159e-08f; /* 0x33a22168 */
2828

2929
static const float
3030
/* coefficients for R(x^2) */
31-
pS0 = 1.6666586697e-01,
32-
pS1 = -4.2743422091e-02,
33-
pS2 = -8.6563630030e-03,
34-
qS1 = -7.0662963390e-01;
31+
pS0 = 1.6666586697e-01f,
32+
pS1 = -4.2743422091e-02f,
33+
pS2 = -8.6563630030e-03f,
34+
qS1 = -7.0662963390e-01f;
3535

3636
static float R(float z)
3737
{

lib/libm/atan2f.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include "libm.h"
2323

2424
static const float
25-
pi = 3.1415927410e+00, /* 0x40490fdb */
26-
pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
25+
pi = 3.1415927410e+00f, /* 0x40490fdb */
26+
pi_lo = -8.7422776573e-08f; /* 0xb3bbbd2e */
2727

2828
float atan2f(float y, float x)
2929
{

lib/libm/atanf.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@
2323
#include "libm.h"
2424

2525
static const float atanhi[] = {
26-
4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */
27-
7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */
28-
9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */
29-
1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */
26+
4.6364760399e-01f, /* atan(0.5)hi 0x3eed6338 */
27+
7.8539812565e-01f, /* atan(1.0)hi 0x3f490fda */
28+
9.8279368877e-01f, /* atan(1.5)hi 0x3f7b985e */
29+
1.5707962513e+00f, /* atan(inf)hi 0x3fc90fda */
3030
};
3131

3232
static const float atanlo[] = {
33-
5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */
34-
3.7748947079e-08, /* atan(1.0)lo 0x33222168 */
35-
3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */
36-
7.5497894159e-08, /* atan(inf)lo 0x33a22168 */
33+
5.0121582440e-09f, /* atan(0.5)lo 0x31ac3769 */
34+
3.7748947079e-08f, /* atan(1.0)lo 0x33222168 */
35+
3.4473217170e-08f, /* atan(1.5)lo 0x33140fb4 */
36+
7.5497894159e-08f, /* atan(inf)lo 0x33a22168 */
3737
};
3838

3939
static const float aT[] = {
40-
3.3333328366e-01,
41-
-1.9999158382e-01,
42-
1.4253635705e-01,
43-
-1.0648017377e-01,
44-
6.1687607318e-02,
40+
3.3333328366e-01f,
41+
-1.9999158382e-01f,
42+
1.4253635705e-01f,
43+
-1.0648017377e-01f,
44+
6.1687607318e-02f,
4545
};
4646

4747
float atanf(float x)

lib/libm/ef_rem_pio2.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ static const float
9393
#else
9494
static float
9595
#endif
96-
zero = 0.0000000000e+00, /* 0x00000000 */
97-
half = 5.0000000000e-01, /* 0x3f000000 */
98-
two8 = 2.5600000000e+02, /* 0x43800000 */
99-
invpio2 = 6.3661980629e-01, /* 0x3f22f984 */
100-
pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */
101-
pio2_1t = 1.0804334124e-05, /* 0x37354443 */
102-
pio2_2 = 1.0804273188e-05, /* 0x37354400 */
103-
pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */
104-
pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */
105-
pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
96+
zero = 0.0000000000e+00f, /* 0x00000000 */
97+
half = 5.0000000000e-01f, /* 0x3f000000 */
98+
two8 = 2.5600000000e+02f, /* 0x43800000 */
99+
invpio2 = 6.3661980629e-01f, /* 0x3f22f984 */
100+
pio2_1 = 1.5707855225e+00f, /* 0x3fc90f80 */
101+
pio2_1t = 1.0804334124e-05f, /* 0x37354443 */
102+
pio2_2 = 1.0804273188e-05f, /* 0x37354400 */
103+
pio2_2t = 6.0770999344e-11f, /* 0x2e85a308 */
104+
pio2_3 = 6.0770943833e-11f, /* 0x2e85a300 */
105+
pio2_3t = 6.1232342629e-17f; /* 0x248d3132 */
106106

107107
#ifdef __STDC__
108108
__int32_t __ieee754_rem_pio2f(float x, float *y)

lib/libm/ef_sqrt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#include "fdlibm.h"
2626

2727
#ifdef __STDC__
28-
static const float one = 1.0, tiny=1.0e-30;
28+
static const float one = 1.0f, tiny=1.0e-30f;
2929
#else
30-
static float one = 1.0, tiny=1.0e-30;
30+
static float one = 1.0f, tiny=1.0e-30f;
3131
#endif
3232

3333
// sqrtf is exactly __ieee754_sqrtf when _IEEE_LIBM defined

lib/libm/erf_lgamma.c

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,77 +32,77 @@ static const float
3232
#else
3333
static float
3434
#endif
35-
two23= 8.3886080000e+06, /* 0x4b000000 */
36-
half= 5.0000000000e-01, /* 0x3f000000 */
37-
one = 1.0000000000e+00, /* 0x3f800000 */
38-
pi = 3.1415927410e+00, /* 0x40490fdb */
39-
a0 = 7.7215664089e-02, /* 0x3d9e233f */
40-
a1 = 3.2246702909e-01, /* 0x3ea51a66 */
41-
a2 = 6.7352302372e-02, /* 0x3d89f001 */
42-
a3 = 2.0580807701e-02, /* 0x3ca89915 */
43-
a4 = 7.3855509982e-03, /* 0x3bf2027e */
44-
a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */
45-
a6 = 1.1927076848e-03, /* 0x3a9c54a1 */
46-
a7 = 5.1006977446e-04, /* 0x3a05b634 */
47-
a8 = 2.2086278477e-04, /* 0x39679767 */
48-
a9 = 1.0801156895e-04, /* 0x38e28445 */
49-
a10 = 2.5214456400e-05, /* 0x37d383a2 */
50-
a11 = 4.4864096708e-05, /* 0x383c2c75 */
51-
tc = 1.4616321325e+00, /* 0x3fbb16c3 */
52-
tf = -1.2148628384e-01, /* 0xbdf8cdcd */
35+
two23= 8.3886080000e+06f, /* 0x4b000000 */
36+
half= 5.0000000000e-01f, /* 0x3f000000 */
37+
one = 1.0000000000e+00f, /* 0x3f800000 */
38+
pi = 3.1415927410e+00f, /* 0x40490fdb */
39+
a0 = 7.7215664089e-02f, /* 0x3d9e233f */
40+
a1 = 3.2246702909e-01f, /* 0x3ea51a66 */
41+
a2 = 6.7352302372e-02f, /* 0x3d89f001 */
42+
a3 = 2.0580807701e-02f, /* 0x3ca89915 */
43+
a4 = 7.3855509982e-03f, /* 0x3bf2027e */
44+
a5 = 2.8905137442e-03f, /* 0x3b3d6ec6 */
45+
a6 = 1.1927076848e-03f, /* 0x3a9c54a1 */
46+
a7 = 5.1006977446e-04f, /* 0x3a05b634 */
47+
a8 = 2.2086278477e-04f, /* 0x39679767 */
48+
a9 = 1.0801156895e-04f, /* 0x38e28445 */
49+
a10 = 2.5214456400e-05f, /* 0x37d383a2 */
50+
a11 = 4.4864096708e-05f, /* 0x383c2c75 */
51+
tc = 1.4616321325e+00f, /* 0x3fbb16c3 */
52+
tf = -1.2148628384e-01f, /* 0xbdf8cdcd */
5353
/* tt = -(tail of tf) */
54-
tt = 6.6971006518e-09, /* 0x31e61c52 */
55-
t0 = 4.8383611441e-01, /* 0x3ef7b95e */
56-
t1 = -1.4758771658e-01, /* 0xbe17213c */
57-
t2 = 6.4624942839e-02, /* 0x3d845a15 */
58-
t3 = -3.2788541168e-02, /* 0xbd064d47 */
59-
t4 = 1.7970675603e-02, /* 0x3c93373d */
60-
t5 = -1.0314224288e-02, /* 0xbc28fcfe */
61-
t6 = 6.1005386524e-03, /* 0x3bc7e707 */
62-
t7 = -3.6845202558e-03, /* 0xbb7177fe */
63-
t8 = 2.2596477065e-03, /* 0x3b141699 */
64-
t9 = -1.4034647029e-03, /* 0xbab7f476 */
65-
t10 = 8.8108185446e-04, /* 0x3a66f867 */
66-
t11 = -5.3859531181e-04, /* 0xba0d3085 */
67-
t12 = 3.1563205994e-04, /* 0x39a57b6b */
68-
t13 = -3.1275415677e-04, /* 0xb9a3f927 */
69-
t14 = 3.3552918467e-04, /* 0x39afe9f7 */
70-
u0 = -7.7215664089e-02, /* 0xbd9e233f */
71-
u1 = 6.3282704353e-01, /* 0x3f2200f4 */
72-
u2 = 1.4549225569e+00, /* 0x3fba3ae7 */
73-
u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */
74-
u4 = 2.2896373272e-01, /* 0x3e6a7578 */
75-
u5 = 1.3381091878e-02, /* 0x3c5b3c5e */
76-
v1 = 2.4559779167e+00, /* 0x401d2ebe */
77-
v2 = 2.1284897327e+00, /* 0x4008392d */
78-
v3 = 7.6928514242e-01, /* 0x3f44efdf */
79-
v4 = 1.0422264785e-01, /* 0x3dd572af */
80-
v5 = 3.2170924824e-03, /* 0x3b52d5db */
81-
s0 = -7.7215664089e-02, /* 0xbd9e233f */
82-
s1 = 2.1498242021e-01, /* 0x3e5c245a */
83-
s2 = 3.2577878237e-01, /* 0x3ea6cc7a */
84-
s3 = 1.4635047317e-01, /* 0x3e15dce6 */
85-
s4 = 2.6642270386e-02, /* 0x3cda40e4 */
86-
s5 = 1.8402845599e-03, /* 0x3af135b4 */
87-
s6 = 3.1947532989e-05, /* 0x3805ff67 */
88-
r1 = 1.3920053244e+00, /* 0x3fb22d3b */
89-
r2 = 7.2193557024e-01, /* 0x3f38d0c5 */
90-
r3 = 1.7193385959e-01, /* 0x3e300f6e */
91-
r4 = 1.8645919859e-02, /* 0x3c98bf54 */
92-
r5 = 7.7794247773e-04, /* 0x3a4beed6 */
93-
r6 = 7.3266842264e-06, /* 0x36f5d7bd */
94-
w0 = 4.1893854737e-01, /* 0x3ed67f1d */
95-
w1 = 8.3333335817e-02, /* 0x3daaaaab */
96-
w2 = -2.7777778450e-03, /* 0xbb360b61 */
97-
w3 = 7.9365057172e-04, /* 0x3a500cfd */
98-
w4 = -5.9518753551e-04, /* 0xba1c065c */
99-
w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */
100-
w6 = -1.6309292987e-03; /* 0xbad5c4e8 */
54+
tt = 6.6971006518e-09f, /* 0x31e61c52 */
55+
t0 = 4.8383611441e-01f, /* 0x3ef7b95e */
56+
t1 = -1.4758771658e-01f, /* 0xbe17213c */
57+
t2 = 6.4624942839e-02f, /* 0x3d845a15 */
58+
t3 = -3.2788541168e-02f, /* 0xbd064d47 */
59+
t4 = 1.7970675603e-02f, /* 0x3c93373d */
60+
t5 = -1.0314224288e-02f, /* 0xbc28fcfe */
61+
t6 = 6.1005386524e-03f, /* 0x3bc7e707 */
62+
t7 = -3.6845202558e-03f, /* 0xbb7177fe */
63+
t8 = 2.2596477065e-03f, /* 0x3b141699 */
64+
t9 = -1.4034647029e-03f, /* 0xbab7f476 */
65+
t10 = 8.8108185446e-04f, /* 0x3a66f867 */
66+
t11 = -5.3859531181e-04f, /* 0xba0d3085 */
67+
t12 = 3.1563205994e-04f, /* 0x39a57b6b */
68+
t13 = -3.1275415677e-04f, /* 0xb9a3f927 */
69+
t14 = 3.3552918467e-04f, /* 0x39afe9f7 */
70+
u0 = -7.7215664089e-02f, /* 0xbd9e233f */
71+
u1 = 6.3282704353e-01f, /* 0x3f2200f4 */
72+
u2 = 1.4549225569e+00f, /* 0x3fba3ae7 */
73+
u3 = 9.7771751881e-01f, /* 0x3f7a4bb2 */
74+
u4 = 2.2896373272e-01f, /* 0x3e6a7578 */
75+
u5 = 1.3381091878e-02f, /* 0x3c5b3c5e */
76+
v1 = 2.4559779167e+00f, /* 0x401d2ebe */
77+
v2 = 2.1284897327e+00f, /* 0x4008392d */
78+
v3 = 7.6928514242e-01f, /* 0x3f44efdf */
79+
v4 = 1.0422264785e-01f, /* 0x3dd572af */
80+
v5 = 3.2170924824e-03f, /* 0x3b52d5db */
81+
s0 = -7.7215664089e-02f, /* 0xbd9e233f */
82+
s1 = 2.1498242021e-01f, /* 0x3e5c245a */
83+
s2 = 3.2577878237e-01f, /* 0x3ea6cc7a */
84+
s3 = 1.4635047317e-01f, /* 0x3e15dce6 */
85+
s4 = 2.6642270386e-02f, /* 0x3cda40e4 */
86+
s5 = 1.8402845599e-03f, /* 0x3af135b4 */
87+
s6 = 3.1947532989e-05f, /* 0x3805ff67 */
88+
r1 = 1.3920053244e+00f, /* 0x3fb22d3b */
89+
r2 = 7.2193557024e-01f, /* 0x3f38d0c5 */
90+
r3 = 1.7193385959e-01f, /* 0x3e300f6e */
91+
r4 = 1.8645919859e-02f, /* 0x3c98bf54 */
92+
r5 = 7.7794247773e-04f, /* 0x3a4beed6 */
93+
r6 = 7.3266842264e-06f, /* 0x36f5d7bd */
94+
w0 = 4.1893854737e-01f, /* 0x3ed67f1d */
95+
w1 = 8.3333335817e-02f, /* 0x3daaaaab */
96+
w2 = -2.7777778450e-03f, /* 0xbb360b61 */
97+
w3 = 7.9365057172e-04f, /* 0x3a500cfd */
98+
w4 = -5.9518753551e-04f, /* 0xba1c065c */
99+
w5 = 8.3633989561e-04f, /* 0x3a5b3dd2 */
100+
w6 = -1.6309292987e-03f; /* 0xbad5c4e8 */
101101

102102
#ifdef __STDC__
103-
static const float zero= 0.0000000000e+00;
103+
static const float zero= 0.0000000000e+00f;
104104
#else
105-
static float zero= 0.0000000000e+00;
105+
static float zero= 0.0000000000e+00f;
106106
#endif
107107

108108
#ifdef __STDC__

lib/libm/kf_cos.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ static const float
2929
#else
3030
static float
3131
#endif
32-
one = 1.0000000000e+00, /* 0x3f800000 */
33-
C1 = 4.1666667908e-02, /* 0x3d2aaaab */
34-
C2 = -1.3888889225e-03, /* 0xbab60b61 */
35-
C3 = 2.4801587642e-05, /* 0x37d00d01 */
36-
C4 = -2.7557314297e-07, /* 0xb493f27c */
37-
C5 = 2.0875723372e-09, /* 0x310f74f6 */
38-
C6 = -1.1359647598e-11; /* 0xad47d74e */
32+
one = 1.0000000000e+00f, /* 0x3f800000 */
33+
C1 = 4.1666667908e-02f, /* 0x3d2aaaab */
34+
C2 = -1.3888889225e-03f, /* 0xbab60b61 */
35+
C3 = 2.4801587642e-05f, /* 0x37d00d01 */
36+
C4 = -2.7557314297e-07f, /* 0xb493f27c */
37+
C5 = 2.0875723372e-09f, /* 0x310f74f6 */
38+
C6 = -1.1359647598e-11f; /* 0xad47d74e */
3939

4040
#ifdef __STDC__
4141
float __kernel_cosf(float x, float y)

lib/libm/kf_rem_pio2.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,28 @@ static const float PIo2[] = {
3838
#else
3939
static float PIo2[] = {
4040
#endif
41-
1.5703125000e+00, /* 0x3fc90000 */
42-
4.5776367188e-04, /* 0x39f00000 */
43-
2.5987625122e-05, /* 0x37da0000 */
44-
7.5437128544e-08, /* 0x33a20000 */
45-
6.0026650317e-11, /* 0x2e840000 */
46-
7.3896444519e-13, /* 0x2b500000 */
47-
5.3845816694e-15, /* 0x27c20000 */
48-
5.6378512969e-18, /* 0x22d00000 */
49-
8.3009228831e-20, /* 0x1fc40000 */
50-
3.2756352257e-22, /* 0x1bc60000 */
51-
6.3331015649e-25, /* 0x17440000 */
41+
1.5703125000e+00f, /* 0x3fc90000 */
42+
4.5776367188e-04f, /* 0x39f00000 */
43+
2.5987625122e-05f, /* 0x37da0000 */
44+
7.5437128544e-08f, /* 0x33a20000 */
45+
6.0026650317e-11f, /* 0x2e840000 */
46+
7.3896444519e-13f, /* 0x2b500000 */
47+
5.3845816694e-15f, /* 0x27c20000 */
48+
5.6378512969e-18f, /* 0x22d00000 */
49+
8.3009228831e-20f, /* 0x1fc40000 */
50+
3.2756352257e-22f, /* 0x1bc60000 */
51+
6.3331015649e-25f, /* 0x17440000 */
5252
};
5353

5454
#ifdef __STDC__
5555
static const float
5656
#else
5757
static float
5858
#endif
59-
zero = 0.0,
60-
one = 1.0,
61-
two8 = 2.5600000000e+02, /* 0x43800000 */
62-
twon8 = 3.9062500000e-03; /* 0x3b800000 */
59+
zero = 0.0f,
60+
one = 1.0f,
61+
two8 = 2.5600000000e+02f, /* 0x43800000 */
62+
twon8 = 3.9062500000e-03f; /* 0x3b800000 */
6363

6464
#ifdef __STDC__
6565
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)

lib/libm/kf_sin.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ static const float
2929
#else
3030
static float
3131
#endif
32-
half = 5.0000000000e-01,/* 0x3f000000 */
33-
S1 = -1.6666667163e-01, /* 0xbe2aaaab */
34-
S2 = 8.3333337680e-03, /* 0x3c088889 */
35-
S3 = -1.9841270114e-04, /* 0xb9500d01 */
36-
S4 = 2.7557314297e-06, /* 0x3638ef1b */
37-
S5 = -2.5050759689e-08, /* 0xb2d72f34 */
38-
S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */
32+
half = 5.0000000000e-01f,/* 0x3f000000 */
33+
S1 = -1.6666667163e-01f, /* 0xbe2aaaab */
34+
S2 = 8.3333337680e-03f, /* 0x3c088889 */
35+
S3 = -1.9841270114e-04f, /* 0xb9500d01 */
36+
S4 = 2.7557314297e-06f, /* 0x3638ef1b */
37+
S5 = -2.5050759689e-08f, /* 0xb2d72f34 */
38+
S6 = 1.5896910177e-10f; /* 0x2f2ec9d3 */
3939

4040
#ifdef __STDC__
4141
float __kernel_sinf(float x, float y, int iy)

0 commit comments

Comments
 (0)