From WikiChip
Difference between revisions of "c/math functions"
m |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{c title|Math Functions}} |
− | While | + | While {{C|basic arithmetics}} works well for many tasks, sometimes more complex math is needed. C provides a set of '''math functions''' for performing some common math operations which include trigonometric functions, exponential and logarithmic functions, power and absolute-value functions, and nearest integer functions. |
− | The function prototype and macro definitions for the math functionality discussed in this article can be can accessed by including the <math.h> standard header. | + | The function prototype and macro definitions for the math functionality discussed in this article can be can accessed by including the {{C|math.h|<math.h>}} standard header. |
+ | |||
+ | On some compilers, due to historical reasons, the math library is stored separately from the rest of the standard C library. In those compilers, you must specify an additional compiler option <code>-lm</code> to link against the math library. | ||
+ | |||
+ | [[Category:C programming language]] |
Latest revision as of 06:25, 4 January 2015
While basic arithmetics works well for many tasks, sometimes more complex math is needed. C provides a set of math functions for performing some common math operations which include trigonometric functions, exponential and logarithmic functions, power and absolute-value functions, and nearest integer functions.
The function prototype and macro definitions for the math functionality discussed in this article can be can accessed by including the <math.h> standard header.
On some compilers, due to historical reasons, the math library is stored separately from the rest of the standard C library. In those compilers, you must specify an additional compiler option -lm
to link against the math library.