At this point for the stmhal port many math functions are still implemented only as placeholders in math.c; lines 99-166 of math.c are as follows:
Code: Select all
// TODO we need import these functions from some library (eg musl or newlib)
float acoshf(float x) { return 0.0; }
float asinhf(float x) { return 0.0; }
float atanhf(float x) { return 0.0; }
float tanf(float x) { return 0.0; }
float acosf(float x) { return 0.0; }
float asinf(float x) { return 0.0; }
float atanf(float x) { return 0.0; }
float atan2f(float x, float y) { return 0.0; }
float fmodf(float x, float y) { return 0.0; }
float tgammaf(float x) { return 0.0; }
float lgammaf(float x) { return 0.0; }
float erff(float x) { return 0.0; }
float erfcf(float x) { return 0.0; }
float modff(float x, float *y) { return 0.0; }
float frexpf(float x, int *exp) { return 0.0; }
float ldexpf(float x, int exp) { return 0.0; }
I assume that the unix port just pulls these functions from glibc or whichever standard C library is available on the system, but I think the issue with the ARM/stmhal port is that these libraries are GPL'd and therefore are not license-compatible with Micro Python's MIT license (I could be mangling this explanation…) so each of these functions needs to be pulled and adapted from a compatible source. Looking at the functions that have already been implemented in math.c, I assume that this is busywork that nobody has gotten to yet - not that I am dismissing the difficulty, because I really don't know… maybe I should just give it a shot when I get a little time, but I hope someone else gets to it before that happens
Edited to add: It appears to this code novice that the basic and complex math modules are implemented in py/modmath.c and py/modcmath.c; depending on which port is being compiled (unix or stmhal) the functions are pulled either from math.h or else are defined in stmhal/math.c
-Bryan