Monday, 5 March 2012

Summary of Trig Functions in C & C++

The following is a summary of trig functions in C and C++. <math.h> library in C, <cmath> in C++.

C++ overloads the functions for different data types.


In C

double sin(double)
float sinf(float)
long double sinl(long double)

double asin(double)
float asinf(float)
long double asinl(long double)

In C++

double | float | long sin(double | float | long)
double | float | long asin(double | float | long)



In C

double cos(double)
float cosf(float)
long double cosl(long double)

double acos(double)
float acosf(float)
long double acos(long double)

In C++

double | float | long cos(double | float | long)
double | float | long acos(double | float | long)



In C

double tan(double)
float tanf(float)
long double tanl(long double)

double atan(double)
float atanf(float)
long double atanf(long double)

In C++

double | float | long tan(double | float | long)
double | float | long atan(double | float | long)


Hyperbolic Trig Functions:

In C

double sinh(double)
float sinhf(float)
long double sinhl(long double)

double cosh(double)
float coshf(float)
long double coshl(long double)

double tanh(double)
float tanhf(float)
long double tanhl(long double)

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

double acosh(double)
float acoshf(float)
long double acosh(long double)

double atanh(double)
float atanhf(float)
long double atanhf(long double)


In C++

double | float | long sinh(double | float | long)
double | float | long cosh(double | float | long)
double | float | long tanh(double | float | long)

The C++11 standard brings in asinh, acosh, & atanh. These functions aren’t implemented in Visual C++ 2010.

No comments:

Post a Comment