diff options
author | aiju <devnull@localhost> | 2018-05-24 13:40:44 +0100 |
---|---|---|
committer | aiju <devnull@localhost> | 2018-05-24 13:40:44 +0100 |
commit | be3809866ce89d2dcac0b02f2ec7b49b5393cb56 (patch) | |
tree | 1c1b211ddbd23367e2c3c692804f814fbe3fba8a /sys/src/ape/lib/ap | |
parent | 930efe67e81635e632f1e6f93e1c56499c79a55f (diff) |
ape: floating point improvements (thanks spew)
Diffstat (limited to 'sys/src/ape/lib/ap')
-rw-r--r-- | sys/src/ape/lib/ap/math/fmin.c | 11 | ||||
-rw-r--r-- | sys/src/ape/lib/ap/math/mkfile | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/src/ape/lib/ap/math/fmin.c b/sys/src/ape/lib/ap/math/fmin.c new file mode 100644 index 000000000..5ab8bc2f1 --- /dev/null +++ b/sys/src/ape/lib/ap/math/fmin.c @@ -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; +} diff --git a/sys/src/ape/lib/ap/math/mkfile b/sys/src/ape/lib/ap/math/mkfile index 5e2d7483f..43ba976fd 100644 --- a/sys/src/ape/lib/ap/math/mkfile +++ b/sys/src/ape/lib/ap/math/mkfile @@ -10,6 +10,7 @@ OFILES=\ fabs.$O\ floor.$O\ fmod.$O\ + fmin.$O\ gamma.$O\ hypot.$O\ j0.$O\ |