summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/math.c
diff options
context:
space:
mode:
authormux <freelancer.c@gmail.com>2014-06-30 16:30:48 +0200
committermux <freelancer.c@gmail.com>2014-06-30 16:31:06 +0200
commit5d44e6a92ca6d371304c89f25add385d9777ebca (patch)
tree19c393711acbe6244be3bd3b912ea0ddc6b9e21e /stmhal/math.c
parent4039a266793f8bb3af24482b3d08b2dcef51e268 (diff)
downloadmicropython-5d44e6a92ca6d371304c89f25add385d9777ebca.tar.gz
micropython-5d44e6a92ca6d371304c89f25add385d9777ebca.zip
Add copysignf
* Fix #692
Diffstat (limited to 'stmhal/math.c')
-rw-r--r--stmhal/math.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/stmhal/math.c b/stmhal/math.c
index 637f447cf1..91ffb2503f 100644
--- a/stmhal/math.c
+++ b/stmhal/math.c
@@ -72,6 +72,7 @@ float __attribute__((pcs("aapcs"))) __aeabi_d2f(double x) {
fx.m = (dx.m>>(52-23)); // right justify
return fx.f;
}
+
double __aeabi_dmul(double x , double y) {
return 0.0;
@@ -85,6 +86,18 @@ float sqrtf(float x) {
return x;
}
+#ifndef NDEBUG
+float copysignf(float x, float y) {
+ float_s_t fx={.f = x};
+ float_s_t fy={.f = y};
+
+ // copy sign bit;
+ fx.s = fy.s;
+
+ return fx.f;
+}
+#endif
+
// some compilers define log2f in terms of logf
#ifdef log2f
#undef log2f