<math.h>
• math.h is a header file in the standard library of the C programming language designed for basic mathematical operations. Most of the functions involve the use of floating point numbers. C++ also implements these functions for compatibility reasons and declares them in the header cmath (the C99 functions are not available in the current C++ standard, C++ 98).
• Mathematical library functions that operate on integers, such as abs, labs, div, and ldiv, are instead specified in the stdlib.h header.
• Mathematical constants (not standard)
Name Description
M_E The base of natural logarithms.
M_LOG2E The logarithm to base 2 of M_E.
M_LOG10E The logarithm to base 10 of M_E.
M_LN2 The natural logarithm of 2.
M_LN10 The natural logarithm of 10.
M_PI Pi, the ratio of a circle's circumference to its diameter.
M_PI_2 Pi divided by two.
M_PI_4 Pi divided by four.
M_1_PI The reciprocal of pi (1/pi).
M_2_PI Two times the reciprocal of pi.
M_2_SQRTPI Two times the reciprocal of the square root of pi.
M_SQRT2 The square root of two.
M_SQRT1_2 The reciprocal of the square root of two (also the square root of 1/2).
• All values are of type double. As an extension, the GNU C library also defines these constants with type long double. The long double macros have a lowercase ‘l’ appended to their names: M_El, M_PIl, and so forth. These are only available if _GNU_SOURCE is defined.
• math.h is a header file in the standard library of the C programming language designed for basic mathematical operations. Most of the functions involve the use of floating point numbers. C++ also implements these functions for compatibility reasons and declares them in the header cmath (the C99 functions are not available in the current C++ standard, C++ 98).
• Mathematical library functions that operate on integers, such as abs, labs, div, and ldiv, are instead specified in the stdlib.h header.
• Mathematical constants (not standard)
Name Description
M_E The base of natural logarithms.
M_LOG2E The logarithm to base 2 of M_E.
M_LOG10E The logarithm to base 10 of M_E.
M_LN2 The natural logarithm of 2.
M_LN10 The natural logarithm of 10.
M_PI Pi, the ratio of a circle's circumference to its diameter.
M_PI_2 Pi divided by two.
M_PI_4 Pi divided by four.
M_1_PI The reciprocal of pi (1/pi).
M_2_PI Two times the reciprocal of pi.
M_2_SQRTPI Two times the reciprocal of the square root of pi.
M_SQRT2 The square root of two.
M_SQRT1_2 The reciprocal of the square root of two (also the square root of 1/2).
• All values are of type double. As an extension, the GNU C library also defines these constants with type long double. The long double macros have a lowercase ‘l’ appended to their names: M_El, M_PIl, and so forth. These are only available if _GNU_SOURCE is defined.
0 comments:
Post a Comment