]> pd.if.org Git - pdclib/blobdiff - functions/math/floor.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / math / floor.c
index 30cc4630d39b0665d75d0a5545af276f6e4ec132..a286149681dd8cf304e4891505743cd5d4a53676 100644 (file)
@@ -15,5 +15,32 @@ long double floor( long double x ) { /* TODO */ };
 // Standard C
 
 double floor( double x ) { /* TODO */ };
+
+/* Therx code
+{
+    return ( x > 0 ) ? (int) x : (int) ( x - 0.9999999999999999 );
+}
+*/
+
+/* PDPC code - unreviewed
+{
+    int y;
+    
+    if (x < 0.0)
+    {
+        y = (int)fabs(x);
+        if ((double)y != x)
+        {
+            y--;
+        }
+    }
+    else
+    {
+        y = (int)x;
+    }
+    return ((double)x);
+}
+*/
+
 float floorf( float x ) { /* TODO */ };
 long double floorl( long double x ) { /* TODO */ };