ape: floating point improvements (thanks spew)
This commit is contained in:
parent
930efe67e8
commit
be3809866c
10 changed files with 27 additions and 0 deletions
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -37,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern double asin(double);
|
||||||
extern double atan(double);
|
extern double atan(double);
|
||||||
extern double atan2(double, double);
|
extern double atan2(double, double);
|
||||||
extern double cos(double);
|
extern double cos(double);
|
||||||
|
extern double hypot(double, double);
|
||||||
extern double sin(double);
|
extern double sin(double);
|
||||||
extern double tan(double);
|
extern double tan(double);
|
||||||
extern double cosh(double);
|
extern double cosh(double);
|
||||||
|
@ -36,6 +37,7 @@ extern double NaN(void);
|
||||||
extern int isNaN(double);
|
extern int isNaN(double);
|
||||||
extern double Inf(int);
|
extern double Inf(int);
|
||||||
extern int isInf(double, int);
|
extern int isInf(double, int);
|
||||||
|
extern double fmin(double, double);
|
||||||
|
|
||||||
#ifdef _RESEARCH_SOURCE
|
#ifdef _RESEARCH_SOURCE
|
||||||
/* does >> treat left operand as unsigned ? */
|
/* does >> treat left operand as unsigned ? */
|
||||||
|
|
11
sys/src/ape/lib/ap/math/fmin.c
Normal file
11
sys/src/ape/lib/ap/math/fmin.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
double
|
||||||
|
fmin(double a, double b)
|
||||||
|
{
|
||||||
|
if(isNaN(a))
|
||||||
|
return b;
|
||||||
|
if(isNaN(b))
|
||||||
|
return a;
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ OFILES=\
|
||||||
fabs.$O\
|
fabs.$O\
|
||||||
floor.$O\
|
floor.$O\
|
||||||
fmod.$O\
|
fmod.$O\
|
||||||
|
fmin.$O\
|
||||||
gamma.$O\
|
gamma.$O\
|
||||||
hypot.$O\
|
hypot.$O\
|
||||||
j0.$O\
|
j0.$O\
|
||||||
|
|
Loading…
Reference in a new issue