C++ Math cbrt()30 Aug 2024 | 1 min read This function is used to find the cube root of a given number. Consider a argument 'arg' :SyntaxSyntax would be : Parameterarg : It is the value of float or integer type. Return valueIt returns the cube root of a given number arg. Example 1Let's see a simple example when argument 'arg' is of integer type Output: Cube root of a number is :2 Example 2Let's see a simple example when an argument 'arg' is of float type. Output: Cube root of a number is :2.33921 Next TopicC++ Math Functions |
math fabs() function
C++ Math fabs() It computes the absolute value of a given number. Suppose a number is 'x': fabs(x) = |x|; Syntax float fabs(float x); double fabs(double x); int fabs(int x); Parameter x: The value whose absolute value is to be determined. Return value It returns the absolute value of x. Example 1 Let's see the simple example...
1 min read
math trunc() function
C++ Math trunc() The function rounds off the given value towards zero and returns the nearest integral value whose magnitude is not greater than the given value. For example: trunc(3.8) = 3; Syntax Suppose a number is 'x'. Syntax would be : return_type trunc(data_type x); Note: return_type can be float,double or long double. Parameter x:...
1 min read
math ceil() function
C++ Math ceil() It rounds the value to the nearest integer which is not less than the given value. For example : ceil(8.1)=9.0; ceil(-8.8)=-8.0; Syntax Suppose a number is 'x'. Syntax would be: double ceil(double x); Parameter x : It is the value that rounds to the nearest integer. Return value It returns the smallest integer value...
1 min read
math fma() function
C++ Math fma() The function computes the expression x*y+z without losing its precision in any intermediate result. Suppose numbers are x,y and z: fma(x,y,z) = x*y+z; Syntax float fma(float x, float y, float z); double fma(double x, double y, double z); long double fma(long double x, long double y, long double z); double fma(type1...
1 min read
math sin() function
C++ Math sin() The function is used to find the sine of an angle given in radian. Syntax Consider a radian 'x'. Syntax would be: float sin(float x); float sin(double x); float sin(long double x); double sin(integral x); Note: If the value passed is an integer type, then it is cast to double. Parameter x:...
1 min read
math isfinite() function
C++ Math isfinite() The function determines the value whether it is finite or not. It should not be NaN or infinite value. If the number is finite, it returns 1 otherwise 0. Note: A finite value is a value that is neither NAN nor infinite. Syntax Suppose a number is...
2 min read
math exp() function
C++ Math exp() The function computes the exponential e raised to the power given number. Suppose a number is x: exp() = ex Syntax Consider a number 'x'. Syntax would be: float exp(float x); double exp(double x); long double exp(long double x); double exp(integral x); Parameter x: The value whose exponential value is to be calculated. Return value It...
1 min read
math fmod() function
C++ Math fmod() The function finds the floating point remainder of numerator/denominator and rounded towards zero. Formula of fmod: fmod= numerator - t*denominator where 't' is the truncated value of numerator/denominator. Syntax Consider a numerator 'n' and denominator 'd'. Syntax would be: double fmod(double n,double d); Parameter n:The value of numerator. d:The value of denominator Return value It...
2 min read
math floor() function
C++ Math floor() It rounds the value to the nearest integer which is not greater than the given value. For example: floor(8.2)=8.0; floor(-8.8)=-9.0; Syntax Suppose a number is 'x'. Syntax would be : double floor(double x); Parameter x : It is the value that rounds to the nearest integer. Return value It returns the value that round...
1 min read
math acos() function
C++ Math acos() This function computes the inverse cosine of a number in radian. acos(x) = cos -1x Syntax Suppose a number is x. Syntax would be: float acos(float x); double acos(double x); long double acos(long double x); double acos(integral x); Note: If the value passed is an integer type, then it is cast to...
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