Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

C99 Mathematical Special Functions.

The TR adds a number of special functions which were first introduced in the C99 standard to header <cmath>.

Refer to the Math Library docs for more information.

namespace std {
namespace tr1 {

   // types
   typedef floating-type double_t;
   typedef floating-type float_t;

   // functions
   double acosh(double x);
   float acoshf(float x);
   long double acoshl(long double x);

   double asinh(double x);
   float asinhf(float x);
   long double asinhl(long double x);

   double atanh(double x);
   float atanhf(float x);
   long double atanhl(long double x);

   double cbrt(double x);
   float cbrtf(float x);
   long double cbrtl(long double x);

   double copysign(double x, double y);
   float copysignf(float x, float y);
   long double copysignl(long double x, long double y);

   double erf(double x);
   float erff(float x);
   long double erfl(long double x);

   double erfc(double x);
   float erfcf(float x);
   long double erfcl(long double x);

   double exp2(double x);
   float exp2f(float x);
   long double exp2l(long double x);

   double expm1(double x);
   float expm1f(float x);
   long double expm1l(long double x);

   double fdim(double x, double y);
   float fdimf(float x, float y);
   long double fdiml(long double x, long double y);

   double fma(double x, double y, double z);
   float fmaf(float x, float y, float z);
   long double fmal(long double x, long double y, long double z);

   double fmax(double x, double y);
   float fmaxf(float x, float y);
   long double fmaxl(long double x, long double y);

   double fmin(double x, double y);
   float fminf(float x, float y);
   long double fminl(long double x, long double y);

   double hypot(double x, double y);
   float hypotf(float x, float y);
   long double hypotl(long double x, long double y);

   int ilogb(double x);
   int ilogbf(float x);
   int ilogbl(long double x);

   double lgamma(double x);
   float lgammaf(float x);
   long double lgammal(long double x);

   long long llrint(double x);
   long long llrintf(float x);
   long long llrintl(long double x);

   long long llround(double x);
   long long llroundf(float x);
   long long llroundl(long double x);

   double log1p(double x);
   float log1pf(float x);
   long double log1pl(long double x);

   double log2(double x);
   float log2f(float x);
   long double log2l(long double x);

   double logb(double x);
   float logbf(float x);
   long double logbl(long double x);

   long lrint(double x);
   long lrintf(float x);
   long lrintl(long double x);

   long lround(double x);
   long lroundf(float x);
   long lroundl(long double x);

   double nan(const char *str);
   float nanf(const char *str);
   long double nanl(const char *str);

   double nearbyint(double x);
   float nearbyintf(float x);
   long double nearbyintl(long double x);

   double nextafter(double x, double y);
   float nextafterf(float x, float y);
   long double nextafterl(long double x, long double y);

   double nexttoward(double x, long double y);
   float nexttowardf(float x, long double y);
   long double nexttowardl(long double x, long double y);

   double remainder(double x, double y);
   float remainderf(float x, float y);
   long double remainderl(long double x, long double y);

   double remquo(double x, double y, int *pquo);
   float remquof(float x, float y, int *pquo);
   long double remquol(long double x, long double y, int *pquo);

   double rint(double x);
   float rintf(float x);
   long double rintl(long double x);

   double round(double x);
   float roundf(float x);
   long double roundl(long double x);

   double scalbln(double x, long ex);
   float scalblnf(float x, long ex);
   long double scalblnl(long double x, long ex);
   double scalbn(double x, int ex);
   float scalbnf(float x, int ex);
   long double scalbnl(long double x, int ex);

   double tgamma(double x);
   float tgammaf(float x);
   long double tgammal(long double x);

   double trunc(double x);
   float truncf(float x);
   long double truncl(long double x);

   // C99 macros defined as C++ templates
   template<class T> bool signbit(T x);
   template<class T> int fpclassify(T x);
   template<class T> bool isfinite(T x);
   template<class T> bool isinf(T x);
   template<class T> bool isnan(T x);
   template<class T> bool isnormal(T x);
   template<class T> bool isgreater(T x, T y);
   template<class T> bool isgreaterequal(T x, T y);
   template<class T> bool isless(T x, T y);
   template<class T> bool islessequal(T x, T y);
   template<class T> bool islessgreater(T x, T y);
   template<class T> bool isunordered(T x, T y);

}} // namespaces

Standard Conformity: The following functions are not supported in the Boost version of this component:

double exp2(double x);
float exp2f(float x);
long double exp2l(long double x);

double fdim(double x, double y);
float fdimf(float x, float y);
long double fdiml(long double x, long double y);

double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y, long double z);

int ilogb(double x);
int ilogbf(float x);
int ilogbl(long double x);

long long llrint(double x);
long long llrintf(float x);
long long llrintl(long double x);

double log2(double x);
float log2f(float x);
long double log2l(long double x);

double logb(double x);
float logbf(float x);
long double logbl(long double x);

long lrint(double x);
long lrintf(float x);
long lrintl(long double x);

double nan(const char *str);
float nanf(const char *str);
long double nanl(const char *str);

double nearbyint(double x);
float nearbyintf(float x);
long double nearbyintl(long double x);

double remainder(double x, double y);
float remainderf(float x, float y);
long double remainderl(long double x, long double y);

double remquo(double x, double y, int *pquo);
float remquof(float x, float y, int *pquo);
long double remquol(long double x, long double y, int *pquo);

double rint(double x);
float rintf(float x);
long double rintl(long double x);

double scalbln(double x, long ex);
float scalblnf(float x, long ex);
long double scalblnl(long double x, long ex);
double scalbn(double x, int ex);
float scalbnf(float x, int ex);
long double scalbnl(long double x, int ex);

// C99 macros defined as C++ templates
template<class T> bool isgreater(T x, T y);
template<class T> bool isgreaterequal(T x, T y);
template<class T> bool isless(T x, T y);
template<class T> bool islessequal(T x, T y);
template<class T> bool islessgreater(T x, T y);
template<class T> bool isunordered(T x, T y);

PrevUpHomeNext