X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fmath%2Ffloor.c;h=a286149681dd8cf304e4891505743cd5d4a53676;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=30cc4630d39b0665d75d0a5545af276f6e4ec132;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/math/floor.c b/functions/math/floor.c index 30cc463..a286149 100644 --- a/functions/math/floor.c +++ b/functions/math/floor.c @@ -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 */ };