C++ Math floor()30 Aug 2024 | 1 min read It rounds the value to the nearest integer which is not greater than the given value. For example: SyntaxSuppose a number is 'x'. Syntax would be : Parameterx : It is the value that rounds to the nearest integer. Return valueIt returns the value that round to the nearest integer not greater than x. Example 1Let's see a simple example by considering a positive value. Output: Initial value of x is : 7.8 Now, the value of x is :7 Example 2Let's see a simple example by considering a negative value. Output: Initial value of x is : -10.2 Now, the value of x is :-11 Next TopicC++ Math Functions |
math modf() function
C++ Math modf() This function is used to divide a number into integral and fractional part. For example : 2.16 = 2 + 16 Syntax Suppose a number is 'x' and 'ptr' is the pointer to an integral part. float modf(float x, float* ptr); double modf(double x, double* ptr); long double modf(long double x,...
2 min read
math sinh() function
C++ Math sinh() The function computes the hyperbolic sine of an angle given in radian. Mathematically, sinhx = (ex-e-x/2 Syntax Suppose the hyperbolic angle is x: float sinh(float x); double sinh(double x); long double sinh(long double x); double sinh(integral x); Parameter x: The value representing the hyperbolic anle. Return value It returns the hyperbolic sine of an angle. Example 1 Let's...
1 min read
math exp2() function
C++ Math exp2() The function computes the base - 2 exponential function of a given number. Suppose a number is 'x': exp2(x) = 2<sup>x</sup> Syntax float exp2(float x); double exp2(double x); long double exp2(long double x); double exp2(integral x); Parameter x: It is the value of the exponent. Return value It returns, 2 raised to the power x....
1 min read
math sqrt() function
sqrt() in C++ In C++, the sqrt() function is used to calculate the square root of a non-negative value. It belongs to the library and produces a double-type result. This function is accessed through the header. It is specified in the header file. It calculates the positive...
4 min read
math isnan() function
C++ Math isnan() The function checks whether the number is a Not a Number or not. If the number is NaN, it returns 1 otherwise 0. Note: The NaN is a non-representable value for floating point elements such as square root of negative number or the result of...
1 min read
math erfc() function
C++ Math erfc() The erfc() function computes the complementary error function value of a parameter passed to the function. Suppose a number is 'x': erfc(x) = 1-erf(x); Syntax float erfc(float x) ; double erfc(double x) ; long double erfc(long double x) ; double erfc(integral x); Parameter x: It is a floating point value. Return value It returns the...
2 min read
math frexp() function
C++ Math frexp() This function breaks the floating point number into the binary significand and an integral exponent. Let the floating point number be x then, x = (significand)*2e where, 'e' is the exponent and 'significand' is the binary significand Syntax Suppose a floating point number be 'x' and pointer be...
3 min read
math cbrt() function
C++ Math cbrt() This function is used to find the cube root of a given number. Consider a argument 'arg' : Cube root of a number : ∛arg Syntax Syntax would be : double cbrt(double arg); float cbrt(float arg); long double cbrt(long double arg); double cbrt(integral arg); Parameter arg : It is the value of float or...
1 min read
math islessequal() function
C++ Math islessequal() The islessequal() function checks whether the value of first argument is less than or equal to the second argument. If the value of first argument is less than or equal to the value of second argument, then it returns 1 otherwise 0. Note: If...
2 min read
math less() function
C++ Math less() The less() function determines whether the value of first argument is less than the value of second argument. If first argument is less than the second argument then it returns 1 otherwise 0. Note: If one or both the arguments are NAN, then the...
2 min read
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India