Skip to content

Commit 5d44e6a

Browse files
committed
Add copysignf
* Fix adafruit#692
1 parent 4039a26 commit 5d44e6a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

stmhal/math.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ float __attribute__((pcs("aapcs"))) __aeabi_d2f(double x) {
7272
fx.m = (dx.m>>(52-23)); // right justify
7373
return fx.f;
7474
}
75+
7576
double __aeabi_dmul(double x , double y) {
7677
return 0.0;
7778

@@ -85,6 +86,18 @@ float sqrtf(float x) {
8586
return x;
8687
}
8788

89+
#ifndef NDEBUG
90+
float copysignf(float x, float y) {
91+
float_s_t fx={.f = x};
92+
float_s_t fy={.f = y};
93+
94+
// copy sign bit;
95+
fx.s = fy.s;
96+
97+
return fx.f;
98+
}
99+
#endif
100+
88101
// some compilers define log2f in terms of logf
89102
#ifdef log2f
90103
#undef log2f

0 commit comments

Comments
 (0)