Tru64: Floating-point rounding control.
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 22 Sep 2014 11:49:46 +0000 (07:49 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 26 Sep 2014 21:04:52 +0000 (17:04 -0400)
ext/POSIX/POSIX.xs

index dccf689..1757549 100644 (file)
@@ -818,6 +818,14 @@ static int my_fegetround()
   case 3: return FE_DOWNWARD;
   default: return -1;
   }
+#elif defined(__osf__) /* Tru64 */
+  switch (read_rnd()) {
+  case FP_RND_RN: return FE_TONEAREST;
+  case FP_RND_RZ: return FE_TOWARDZERO;
+  case FP_RND_RM: return FE_DOWNWARD;
+  case FP_RND_RP: return FE_UPWARD;
+  default: return -1;
+  }
 #else
   return -1;
 #endif
@@ -2235,6 +2243,14 @@ fesetround(x)
        case FE_UPWARD:     RETVAL = fpsetround(FP_RP); break;
         default: RETVAL = -1; break;
        }
+#elif defined(__osf__) /* Tru64 */
+       switch (x) {
+       case FE_TONEAREST:  RETVAL = write_rnd(FP_RND_RN); break;
+       case FE_TOWARDZERO: RETVAL = write_rnd(FP_RND_RZ); break;
+       case FE_DOWNWARD:   RETVAL = write_rnd(FP_RND_RM); break;
+       case FE_UPWARD:     RETVAL = write_rnd(FP_RND_RP); break;
+        default: RETVAL = -1; break;
+       }
 #else
        RETVAL = -1;
        not_here("fesetround");