Answer: Most of the floating-point functions defined in ‘math.h’ header take their arguments as double and return double values. These functions range from Trigonometric to Hyperbolic to Logarithmic and Exponential to Power functions to Floor, Ceiling, Absolute value and Remainder functions to String conversion functions.
String conversion functions under Floating-point category are similar to string conversion Functions under Integer category except that former returns converted value as type double while latter returns converted value as variant of type int.
Note also that domain error occurs if argument to a function isn’t within domain defined for that function. For example,
Notice that power() returns first argument, say x, raised to second argument, say y, i.e. ‘x ^ y’. Since logarithms could also be used to compute ‘x ^ y’, domain error occurs if either x is -ve or y is non-integer. When domain error occurs, function returns an error value defined by implementation, value EDOM is stored in errno.
A range error, ERANGE, occurs if return value is too large or too small to be represented in a double. HUGE_VAL, a double value defined in ‘math.h’ will be reported as range error if return value is too large to be represented in a double. Range error also occurs when result is too small to be represented in double. In this case function returns 0. In either case, ERANGE is stored in errno.
Sanfoundry Global Education & Learning Series – 1000 C Tutorials.