Skip to content

Commit 3bedff0

Browse files
committed
lib/libm/math: Remove implementations of float conversion functions.
These implementations are incorrect (eg f2d and d2f don't handle special values like 0.0) and proper versions can be provided by libgcc (or equivalent depending on the toolchain). libgcc is now linked with the stmhal port so that library will provide these functions from now on.
1 parent c064f0a commit 3bedff0

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

lib/libm/math.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,6 @@ typedef union {
3636
};
3737
} float_s_t;
3838

39-
typedef union {
40-
double d;
41-
struct {
42-
uint64_t m : 52;
43-
uint64_t e : 11;
44-
uint64_t s : 1;
45-
};
46-
} double_s_t;
47-
48-
#if defined(__thumb__)
49-
50-
double __attribute__((pcs("aapcs"))) __aeabi_i2d(int32_t x) {
51-
return (float)x;
52-
}
53-
54-
// TODO
55-
long long __attribute__((pcs("aapcs"))) __aeabi_f2lz(float x) {
56-
return (long)x;
57-
}
58-
59-
double __attribute__((pcs("aapcs"))) __aeabi_f2d(float x) {
60-
float_s_t fx={0};
61-
double_s_t dx={0};
62-
63-
fx.f = x;
64-
dx.s = (fx.s);
65-
dx.e = (fx.e-127+1023) & 0x7FF;
66-
dx.m = fx.m;
67-
dx.m <<=(52-23); // left justify
68-
return dx.d;
69-
}
70-
71-
float __attribute__((pcs("aapcs"))) __aeabi_d2f(double x) {
72-
float_s_t fx={0};
73-
double_s_t dx={0};
74-
75-
dx.d = x;
76-
fx.s = (dx.s);
77-
fx.e = (dx.e-1023+127) & 0xFF;
78-
fx.m = (dx.m>>(52-23)); // right justify
79-
return fx.f;
80-
}
81-
82-
double __aeabi_dmul(double x , double y) {
83-
return 0.0;
84-
85-
}
86-
87-
#endif // defined(__thumb__)
88-
8939
#ifndef NDEBUG
9040
float copysignf(float x, float y) {
9141
float_s_t fx={.f = x};

0 commit comments

Comments
 (0)