Interview answers verified by specialists.

Find interview questions and answers on this website:

See right interview answers on 30 common job interview questions

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 filemath.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 valueEDOM. If the return value of the function is too large or small to be represented by adouble(causing overflow or underflow), the function will returnHUGE_VAL(for overflow) or0(for underflow) and will set errno toERANGE. The valuesEDOM,ERANGE, andHUGE_VALare defined inmath.h. The following list describes the functions declared inmath.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 toacos()andasin()must be in the range-1to1, inclusive. 3.double atan2(double x, double y)returns the arc tangent of the value represented byx/y, even ifx/yis not representable as adouble(ifyis0, 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 ofx, and the logarithm base10ofx, respectively. The two logarithm functions will cause a range error (ERANGE) ifxis0and 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 << operator for integers. 8.double pow(double b, double e)returns be. It causes a domain error (EDOM) ifbis0andeis less than or equal to0, or ifbis less than0andeis not an integral value. 9.double frexp(double n, int *i)returns the mantissa ofnand sets the int pointed to byito the exponent ofn. Themantissais in the range0.5to1(excluding 1 itself ), and the exponent is a number such thatn = mantissa * 2exponent. 10.double modf(double n, int *i)returns the fractional part ofnand sets theintpointed to byito the integer part ofn. 11.double ceil(double),double floor(double)return the smallest integer greater than or equal to and the largest integer less than or equal to their arguments, respectively. For instance,ceil(-1.1)returns-1.0, andfloor(-1.1)returns-2.0. 12.double fmod(double x, double y)returns the remainder ofx/y. This is similar to the%operator for integers, but it does not restrict its inputs or result to be ints. It causes a domain error (EDOM) ifyis0. 13.double fabs(double)returns the absolute value of the value passed to it (a number with the same magnitude, but always positive). For instance,fabs(-3.14)returns3.14.