[MLton-commit] r4503
Stephen Weeks
MLton@mlton.org
Tue, 9 May 2006 15:42:55 -0700
Added missing float math functions on SunOS 5.8.
----------------------------------------------------------------------
A mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.c
A mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.h
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.h
----------------------------------------------------------------------
Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.c 2006-05-09 20:44:22 UTC (rev 4502)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.c 2006-05-09 22:42:55 UTC (rev 4503)
@@ -0,0 +1,37 @@
+#define unaryReal(func) \
+float func##f (float x) { \
+ return (float)(func((double)x)); \
+}
+unaryReal(acos)
+unaryReal(asin)
+unaryReal(atan)
+unaryReal(cos)
+unaryReal(cosh)
+unaryReal(exp)
+unaryReal(fabs)
+unaryReal(log)
+unaryReal(log10)
+unaryReal(rint)
+unaryReal(sin)
+unaryReal(sinh)
+unaryReal(sqrt)
+unaryReal(tan)
+unaryReal(tanh)
+#undef unaryReal
+
+#define binaryReal(func) \
+float func##f (float x, float y) { \
+ return (float)(func((double)x, (double)y)); \
+}
+binaryReal(atan2)
+binaryReal(nextafter)
+binaryReal(pow)
+#undef binaryReal
+
+float frexpf(float x, int *exp) {
+ return (float)frexp((double)x, exp);
+}
+
+float ldexpf (float x, int i) {
+ return (float)ldexp((double)x, i);
+}
Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.h 2006-05-09 20:44:22 UTC (rev 4502)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/float-math.h 2006-05-09 22:42:55 UTC (rev 4503)
@@ -0,0 +1,26 @@
+#define unaryReal(func) float func##f (float x);
+unaryReal(acos)
+unaryReal(asin)
+unaryReal(atan)
+unaryReal(cos)
+unaryReal(cosh)
+unaryReal(exp)
+unaryReal(fabs)
+unaryReal(log)
+unaryReal(log10)
+unaryReal(rint)
+unaryReal(sin)
+unaryReal(sinh)
+unaryReal(sqrt)
+unaryReal(tan)
+unaryReal(tanh)
+#undef unaryReal
+
+#define binaryReal(func) float func##f (float x, float y);
+binaryReal(atan2)
+binaryReal(nextafter)
+binaryReal(pow)
+#undef binaryReal
+
+float frexpf(float x, int *e);
+float ldexpf (float x, int i);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.c 2006-05-09 20:44:22 UTC (rev 4502)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.c 2006-05-09 22:42:55 UTC (rev 4503)
@@ -2,6 +2,7 @@
#include <ieeefp.h>
+#include "float-math.c"
#include "getText.c"
#include "mkdir2.c"
#include "mmap.c"
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.h 2006-05-09 20:44:22 UTC (rev 4502)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/solaris.h 2006-05-09 22:42:55 UTC (rev 4503)
@@ -22,6 +22,7 @@
#include <ucontext.h>
#include "feround.h"
+#include "float-math.h"
#include "setenv.h"
#define FE_TONEAREST 0