[MLton-commit] r5895

Ville Laurikari ville at mlton.org
Mon Aug 20 02:15:09 PDT 2007


The math functions modff(), rintf(), frexpf(), and ldexpf() do not
exist on hppa-hpux.  Implemented replacements in terms of modf(),
rint(), frexp(), and ldexp(), respectively.

----------------------------------------------------------------------

U   mlton/trunk/runtime/platform/hpux.c
U   mlton/trunk/runtime/platform/hpux.h

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/platform/hpux.c
===================================================================
--- mlton/trunk/runtime/platform/hpux.c	2007-08-19 22:50:34 UTC (rev 5894)
+++ mlton/trunk/runtime/platform/hpux.c	2007-08-20 09:15:08 UTC (rev 5895)
@@ -120,3 +120,25 @@
                 diee ("failed to get physical memory size");
         return buf.physical_memory * buf.page_size;
 }
+
+#ifdef __hppa__
+float modff (float x, float *iptr)
+{
+        double d, i;
+        d = modf ((double)x, &i);
+        *iptr = (float)i;
+        return d;
+}
+
+float rintf (float x) {
+        return (float)rint ((double)x);
+}
+
+float frexpf (float x, int *e) {
+        return (float)frexp ((double)x, e);
+}
+
+float ldexpf (float x, int e) {
+        return (float)ldexp ((double)x, e);
+}
+#endif /* __hppa__ */

Modified: mlton/trunk/runtime/platform/hpux.h
===================================================================
--- mlton/trunk/runtime/platform/hpux.h	2007-08-19 22:50:34 UTC (rev 5894)
+++ mlton/trunk/runtime/platform/hpux.h	2007-08-20 09:15:08 UTC (rev 5895)
@@ -81,13 +81,13 @@
 
 typedef long suseconds_t; // type of timeval.tv_usec in sys/time.h
 
-#if HPUX_VERSION <= 1100
-/* These GCC builtins aren't defined in the system headers. */
+#ifdef __hppa__
+/* These do not exist on HPPA, so we implement our own. */
 float modff(float x, float *iptr);
 float rintf(float x);
 float frexpf(float x, int *exp);
 float ldexpf(float x, int exp);
-#endif /* HPUX_VERSION <= 1100 */
+#endif /* __hppa__ */
 
 #define PRIxPTR "lx"
 #define PRIuPTR "lu"




More information about the MLton-commit mailing list