What math functions are available for integers? For floating point? Ans. The operations , -, *, and / (addition, subtraction, multiplication, and division) are available for both integer and floating-point arithmetic. The operator % (remainder) is available for integers only. For floating-point math, many other functions are declared in the header file math.h. Most of these functions operate in double-precision floating point, for increased accuracy. If these functions are passed an argument outside of their domain (the domain of a function is the set of legal values for which it is defined), the function will return some unspecified value and will set the variable errno to the value EDOM. If the return value of the function is too large or small to be represented by a double (causing overflow or underflow), the function will return HUGE_VAL (for overflow) or 0 (for underflow) and will set errno to ERANGE. The values EDOM, ERANGE, and HUGE_VAL are defined in math.h. The following list describes the functions declared in math.h: 1. double cos(double), double sin(double), double tan(double) take a value in radians and return the cosine, sine, and tangent of the value, respectively. 2. double acos(double), double asin(double), double atan(double) take a value and return the arc cosine, arc sine, and arc tangent of the value, respectively. The value passed to acos() and asin() must be in the range -1 to 1, inclusive. 3. double atan2(double x, double y) returns the arc tangent of the value represented by x/y, even if x/y is not representable as a double (if y is 0, for instance). 4. double cosh(double), double sinh(double), double tanh(double) take a value in radians and return the hyperbolic cosine, hyperbolic sine, and hyperbolic tangent of the value, respectively. 5. double exp(double x), double log(double x), double log10(double x) take a value and return ex, the natural logarithm of x, and the logarithm base 10 of x, respectively. The two logarithm functions will cause a range error (ERANGE) if x is 0 and a domain error (EDOM) if x is negative. 6. double sqrt(double) returns the square root of its argument. It causes a domain error (EDOM) if the value passed to it is negative. 7. double ldexp(double n, int e) returns n * 2e. This is somewhat analogous to the - Study24x7
Social learning Network
18 Apr 2023 11:27 AM study24x7 study24x7

What math functions are available for integers? For floating point? Ans. The operations +, -, *, and / (addition, subtraction, multiplication, and division) are available for both integer and floating-point arithmetic. The operator % (remainder) is available for integers only. ...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles