Browse Source

libm: Add two missing functions

K. Lange 11 months ago
parent
commit
44eefc2e43
3 changed files with 13 additions and 1 deletions
  1. 2 0
      base/usr/include/math.h
  2. 1 1
      kuroko
  3. 10 0
      libc/math/bad.c

+ 2 - 0
base/usr/include/math.h

@@ -36,6 +36,8 @@ extern double sinh(double x);
 extern double tan(double x);
 extern double tanh(double x);
 extern double atan(double x);
+extern double log1p(double x);
+extern double expm1(double x);
 
 extern double modf(double x, double *iptr);
 

+ 1 - 1
kuroko

@@ -1 +1 @@
-Subproject commit 7e96bdeec1e587a5304c2c8871d88f523df18334
+Subproject commit fa6dbc8365ed442f4fbb619827feb08b93a71e2f

+ 10 - 0
libc/math/bad.c

@@ -1,6 +1,7 @@
 /* STUB MATH LIBRARY */
 #include <stdio.h>
 #include <stdlib.h>
+#include <math.h>
 
 extern char * _argv_0;
 #define BAD do { if (getenv("LIBM_DEBUG")) { fprintf(stderr, "%s called bad math function %s\n", _argv_0, __func__); } } while (0)
@@ -39,3 +40,12 @@ double log2(double x) {
 	return 0.0;
 }
 
+double log1p(double x) {
+	BAD;
+	return log(x+1.0);
+}
+
+double expm1(double x) {
+	BAD;
+	return exp(x) - 1.0;
+}