X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fmath%2Ffloor.c;h=a286149681dd8cf304e4891505743cd5d4a53676;hp=30cc4630d39b0665d75d0a5545af276f6e4ec132;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec 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 */ };