X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=includes%2Fmath.h;fp=includes%2Fmath.h;h=ef80c92775d192540504a4ab664b2b5d9ee756f8;hb=e081ed1387e0c27dc689c8e32fdda06039544107;hp=ee4dff7ef0fbe668c7023079e32a56a100b8e4c3;hpb=70f1c6f7c9d515ef426da68973511f46de57005a;p=pdclib diff --git a/includes/math.h b/includes/math.h index ee4dff7..ef80c92 100644 --- a/includes/math.h +++ b/includes/math.h @@ -48,8 +48,6 @@ typedef float_t; // TODO - personality? // -------------------------------------------------------------------------- // MACROS -#ifndef __cplusplus - #define isgreater( x, y ) // TODO #define isgreaterequal( x, y ) // TODO #define isless( x, y ) // TODO @@ -64,279 +62,8 @@ typedef float_t; // TODO - personality? #define isnormal( x ) // TODO #define signbit( x ) // TODO -#else // __cplusplus - -// The same functionality as above is implemented as functions in C++. -bool signbit( float x ); -bool signbit( double x ); -bool signbit( long double x ); -int fpclassify( float x ); -int fpclassify( double x ); -int fpclassify( long double x ); -bool isfinite( float x ); -bool isfinite( double x ); -bool isfinite( long double x ); -bool isinf( float x ); -bool isinf( double x ); -bool isinf( long double x ); -bool isnan( float x ); -bool isnan( double x ); -bool isnan( long double x ); -bool isnormal( float x ); -bool isnormal( double x ); -bool isnormal( long double x ); -bool isgreater( float x, float y ); -bool isgreater( double x, double y ); -bool isgreater( long double x, long double y ); -bool isgreaterequal( float x, float y ); -bool isgreaterequal( double x, double y ); -bool isgreaterequal( long double x, long double y ); -bool isless( float x, float y ); -bool isless( double x, double y ); -bool isless( long double x, long double y ); -bool islessequal( float x, float y ); -bool islessequal( double x, double y ); -bool islessequal( long double x, long double y ); -bool islessgreater( float x, float y ); -bool islessgreater( double x, double y ); -bool islessgreater( long double x, long double y ); -bool isunordered( float x, float y ); -bool isunordered( double x, double y ); -bool isunordered( long double x, long double y ); - -#endif // __cplusplus - -// -------------------------------------------------------------------------- -// FUNCTIONS - C++ - -#ifdef __cplusplus - -// These functions return the magnitude of their parameter. -double abs( double x ); -float abs( float x ); -long double abs( long double x ); -float fabs( float x ); -long double fabs( long double x ); - -// These functions return the sine of their parameter. -float sin( float x ); -long double sin( long double x ); - -// These functions return the hyperbolic sine of their parameter. -float sinh( float x ); -long double sinh( long double x ); - -// These functions return the arcsine of their parameter. -float asin( float x ); -long double asin( long double x ); - -// These functions compute the arc hyperbolic sine of x. -float asinh( float x ); -long double asinh( long double x ); - -// These functions return the cosine of their parameter. -float cos( float x ); -long double cos( long double x ); - -// These functions return the hyperbolic cosine of their parameter. -float cosh( float x ); -long double cosh( long double x ); - -// These functions return the arcsine of their parameter. -float acos( float x ); -long double acos( long double x ); - -// These functions return the hyperbolic arccosine of their parameter. -float acosh( float x ); -long double acosh( long double x ); - -// These functions return the tangent of their parameter. -float tan( float x ); -long double tan( long double x ); - -// These functions return the hyperbolic tangent of their parameter. -float tanh( float x ); -long double tanh( long double x ); - -// These functions return the arctangent of their parameter. -float atan( float x ); -long double atan( long double x ); - -// These functions return the hyperbolic arctangent of their parameter. -float atanh( float x ); -long double atanh( long double x ); - -// TODO -float atan2( float y, float x ); -long double atan2( long double y, long double x ); - -// These functions return sqrt( x^2 + y^2 ). -float hypot( float x, float y ); -long double hypot( long double x, long double y ); - -// These functions return their parameter x, raised to the power y. -float pow( float x, float y ); -long double pow( long double x, long double y ); -double pow( double x, int y ); -float pow( float x, int y ); -long double pow( long double x, int y ); - -// These functions return the square root of their parameter. -float sqrt( float x ); -long double sqrt( long double x ); - -// TODO -float cbrt( float x ); -long double cbrt( long double x ); - -// TODO -float exp( float x ); -long double exp( long double x ); - -// TODO -float exp2( float x ); -long double exp2( long double x ); - -// TODO -float expm1( float x ); -long double expm1( long double x ); - -// TODO -float frexp( float x, int * exponent ); -long double frexp( long double x, int * exponent ); - -// TODO -float ldexp( float x, int exponent ); -long double ldexp( long double x, int exponent ); - -// These functions return the natural logarithm of their parameter. -float log( float x ); -long double log( long double x ); - -// These functions return the logarithm (base 10 ) of their parameter. -float log10( float x ); -long double log10( long double x ); - -// These functions return the logarithm (base 2 ) of their parameter. -float log2( float x ); -long double log2( long double x ); - -// TODO -float logb( float x ); -long double logb( long double x ); - -// TODO -int ilogb( float x ); -int ilogb( long double x ); - -// TODO -float log1p( float x ); -long double log1p( long double x ); - -// These functions return the smallest integer no larger than their parameter -float ceil( float x ); -long double ceil( long double x ); - -// These functions return the biggest integer no larger than their parameter. -float floor( float x ); -long double floor( long double x ); - -// TODO -float fmod( float x, float y ); -long double fmod( long double x, long double y ); - -// TODO -float modf( float x, float * integer ); -long double modf( long double x, long double * integer ); - -// These functions return their parameter x, with the sign of parameter y. -float copysign( float x, float y ); -long double copysign( long double x, long double y ); - -// TODO -float erf( float x ); -long double erf( long double x ); - -// TODO -float erfc( float x ); -long double erfc( long double x ); - -// TODO -float fdim( float x, float y ); -long double fdim( long double x, long double y ); - -// TODO -float fma( float x, float y, float z ); -long double fma( long double x, long double y, long double z ); - -// These functions return the larger of their parameters. -float fmax( float x, float y ); -long double fmax( long double x, long double y ); - -// These functions return the smaller of their parameters. -float fmin( float x, float y ); -long double fmin( long double x, long double y ); - -// TODO -long long llrint( float x ); -long long llrint( long double x ); -long lrint( float x ); -long lrint( long double x ); -float rint( float x ); -long double rint( long double x ); - -// TODO -long long llround( float x ); -long long llround( long double x ); -long lround( float x ); -long lround( long double x ); -float round( float x ); -long double round( long double x ); - -// TODO -float trunc( float x ); -long double trunc( long double x ); - -// TODO -float nearbyint( float x ); -long double nearbyint( long double x ); - -// TODO -float nextafter( float x, float y ); -long double nextafter( long double x, long double y ); - -// TODO -float nexttoward( float x, long double y ); -long double nexttoward( long double x, long double y ); - -// TODO -float remainder( float x, float y ); -long double remainder( long double x, long double y ); - -// TODO -float remquo( float x, float y, int * quotient ); -long double remquo( long double x, long double y, int * quotient ); - -// TODO -float scalbn( float x, int ex ); -long double scalbn( long double x, int ex ); - -// TODO -float scalbln( float x, long ex ); -long double scalbln( long double x, long ex ); - -// TODO -float lgamma( float x ); -long double lgamma( long double x ); - -// TODO -float tgamma( float x ); -long double tgamma( long double x ); - -#endif // __cplusplus - // ---------------------------------------------------------------------------- -// FUNCTIONS - Standard C +// FUNCTIONS // These functions return the magnitude of their parameter. double fabs( double x );