C mathematical functions
C mathematical operations are a group of functions in the standard library of the C programming language implementing basic mathematical functions. All functions use floating-point numbers in one manner or another. Different C standards provide different, albeit backwards-compatible, sets of functions. Most of these functions are also available in the C++ standard library, though in different headers (the C headers are included as well, but only as a deprecated compatibility feature). Overview of functions. Most of the mathematical functions are defined in codice_1 (codice_2 header in C++). The functions that operate on integers, such as  codice_3, codice_4, codice_5, and codice_6, are instead defined in the codice_7 header (codice_8 header in C++). Any functions that operate on angles use radians as the unit of angle. Not all of these functions are available in the C89 version of the standard. For those that are, the functions accept only type codice_9 for the floating-point arguments, leading to expensive type conversions in code that otherwise used single-precision codice_10 values. In C99, this shortcoming was fixed by introducing new sets of functions that work on codice_10 and codice_12 arguments. Those functions are identified by codice_13 and codice_14 suffixes  respectively. Floating-point environment. C99 adds several functions and types for fine-grained control of floating-point environment. These functions can be used to control a variety of settings that affect floating-point computations, for example, the rounding mode, on what conditions exceptions occur, when numbers are flushed to zero, etc. The floating-point environment functions and types are defined in codice_15 header (codice_16 in C++). Complex numbers. C99 adds a new codice_17 keyword (and codice_18 convenience macro) that provides support for complex numbers. Any floating-point type can be modified with codice_18, and is then defined as a pair  of floating-point numbers. Note that C99 and C++ do not implement complex numbers in a code-compatible way – the latter instead provides the class . All operations on complex numbers are defined in codice_20 header. As with the real-valued functions, an codice_13 or codice_14 suffix denotes the codice_23 or codice_24 variant of the function. A few more complex functions are "reserved for future use in C99". Implementations are provided by open-source projects that are not part of the standard library. Type-generic functions. The header codice_25 defines a type-generic macro for each mathematical function defined in codice_1  and codice_20. This adds a limited support for function overloading of the mathematical functions: the same function name can be used with different types of parameters; the actual function will be selected at compile time according to the types of the parameters. Each type-generic macro that corresponds to a function that is defined for both real and complex numbers encapsulates a total of 6 different functions: codice_10, codice_9 and codice_12, and their codice_18 variants. The type-generic macros that correspond to a function that is defined for only real numbers encapsulates a total of 3 different functions: codice_10, codice_9  and codice_12 variants of the function. The C++ language includes native support for function overloading and thus does not provide the codice_25 header even as a compatibility feature. Random number generation. The header codice_7 (codice_8 in C++) defines several functions that can be used for statistically random number generation. The codice_38 family of random number functions are not defined in POSIX standard, but is found in some common codice_39 implementations. It used to refer to the keystream generator of a leaked version of RC4 cipher (hence "alleged RC4"), but different algorithms, usually from other ciphers like ChaCha20, have been implemented  since using the same name. The quality of randomness from codice_40 are usually too weak to be even considered statistically random, and it requires explicit seeding. It is usually advised to use codice_38 instead of codice_40 when possible. Some C libraries implement codice_40 using codice_44 internally. Implementations. Under POSIX systems like Linux and BSD, the mathematical functions (as declared in codice_1) are bundled separately in the mathematical library codice_46. Therefore, if any of those functions are used, the linker must be given the directive codice_47. There are various codice_48 implementations, including: Implementations not necessarily under a name of include: C