X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fmath%2Fabs.c;h=c45527824c8ee66b07138e9972ee388f4514534b;hb=e081ed1387e0c27dc689c8e32fdda06039544107;hp=1cd660dce46225a67b2195d38980a116c2d1435b;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec;p=pdclib diff --git a/functions/math/abs.c b/functions/math/abs.c index 1cd660d..c455278 100644 --- a/functions/math/abs.c +++ b/functions/math/abs.c @@ -5,22 +5,24 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -// C++ +double fabs( double x ) { /* TODO */ }; -double abs( double x ) { /* TODO */ }; -float abs( float x ) { /* TODO */ }; -long double abs( long double x ) { /* TODO */ }; -float fabs( float x ) { /* TODO */ }; -long double fabs( long double x ) { /* TODO */ }; +/* Therx code +{ + return ( x < 0 ) ? -x : x; +} +*/ -long abs( long i ) { /* TODO */ }; -long long abs( long long i ) { /* TODO */ }; +/* PDPC code - unreviewed +{ + if (x < 0.0) + { + x = -x; + } + return (x); +} +*/ -// ---------------------------------------------------------------------------- -// Standard C - -double fabs( double x ) { /* TODO */ }; float fabsf( float x ) { /* TODO */ }; long double fabsl( long double x ) { /* TODO */ };