Mathematical methods and constants commonly used in programming

Source: Internet
Author: User
Tags acos asin

Just list some of the more commonly used, specific can view the Math.h file

Arithmetic functions:

int rand (): Returns the int type random number

int random (): Returns a long type random number

ABS: Returns the absolute value of shaping

int abs (int)

Float fabsf (float)

Double fabs (double)

Long double FABSL (long double)

Floor (): Returns the largest integer not greater than the floating-point number

Float Floorf (float)

Double floor (double)

Long double floorl (long double)

Ceil (): Returns the smallest integer not less than the floating-point number

Float Ceilf (float)

Double ceil (double)

Long double Ceill (long double)

POW (): Returns the B-side of a

Float powf (float, float)

Double pow (double, double)

Long double powl (long double , long double)

SQRT (): Returns the open root of a

Float sqrtf (float);

Double sqrt (double);

A long double Sqrtl (long double);

Trigonometric function:

ACOs: Inverse cosine function (parameter: radians)

Float acosf (float);

Double ACOs (double);

A long double Acosl (long double);

ASIN: Inverse chord function (parameter: radians)

Asinf (float);

Double ASIN (double);

A long double asinl (long double);

Atan: Inverse tangent function (parameter: radians)

Float atanf (float);

Double atan (double);

A long double atanl (long double);

atan2: returns the inverse tangent value of the given a and b coordinate values

Float atan2f (float, float);

Double atan2 (double, double);

A long double atan2l (long double , long double);

Cos: cosine function (parameter: radians)

Float cosf (float);

Double cos (double);

A long double COSL (long double);

sin: sine function (parameter: radians)    

Float sinf (float);

Double sin (double);

  A long double sinl (long double);

Tan: Tangent function (parameter: radians)    

Float tanf (float);

Double tan (double);

A long double tanl (long double);

exponential function:

LOG: With E as the base

Float logf (float);

Double log (double);

A long double logl (long double);

LOG10: base 10

Float log10f (float);

Double log10 (double);

A long double log10l (long double);

constants:

  M_PI =π

M_1_PI = 1/π

M_2_PI = 2/π

M_pi_2 =Π/2

M_pi_4 =Π/4

M_e=e m_log2e=log_2 (E) m_log10e=log_10 (e)# define Cgfloat_min min floating point

# define Cgfloat_max Maximum floating point number

# define Nsintegermax maximum integer type

#define NSINTEGERMIN Minimum integer type

#define NSUINTEGERMAX Max unsigned integral type

#define INFINITY infinitely Large

Mathematical methods and constants commonly used in programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.