micropython: add micropython component
This commit is contained in:
12
components/language/micropython/lib/libm_dbl/tanh.c
Normal file
12
components/language/micropython/lib/libm_dbl/tanh.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <math.h>
|
||||
|
||||
double tanh(double x) {
|
||||
int sign = 0;
|
||||
if (x < 0) {
|
||||
sign = 1;
|
||||
x = -x;
|
||||
}
|
||||
x = expm1(-2 * x);
|
||||
x = x / (x + 2);
|
||||
return sign ? x : -x;
|
||||
}
|
Reference in New Issue
Block a user