C++ Vector hypot()30 Aug 2024 | 1 min read This function finds the square root of the sum of the squares of two numbers. It stands for hypotenuse, is used to find the hypotenuse of a right angled triangle. Consider three numbers x,y and z :hypotenuse of a right angle triangle = √x2+y2 distance from origin in 3d space=√x2+y2+z2 SyntaxSyntax for a right angle triangle would be: Syntax for 3d space would be: Note: If any argument is of long double type, then the return type is promoted to long double. If not, then the return type is promoted to double.Parameter(x,y,z): x,y and z are the values of float or integer type. Return valueIt returns the cube root of the sum of the squares of two numbers. Example 1Let's see a simple example. Output: sides of a right angled triangle are :2,3 third side of a triangle is :3.60555 Next TopicC++ Math Functions |
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
C++ Math copysign() The function returns the value with the magnitude of x and sign of y. Syntax Consider two numbers 'x' and 'y'. Syntax would be: float copysign(float x, float y); double copysign(double x, double y); long double copysign(long double x, long double y); promoted copysign(type1 x, type2 y); Note: If any...
2 min read
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
C++ Math asin() The function computes the inverse sine of a number given in radian. asin(x) = sin-1x Syntax Suppose a number is 'x'. Syntax would be: float asin(float x); double asin(double x); long double asin(long double x); double asin(integral x); Note: If the value passed is an integer type, then it is cast to...
2 min read
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
C++ Math ilogb() The function returns the exponent part of a given number i.e integral part of logx. ilogb() function is equivalent to (int)logb() Syntax int ilogb(float x); int ilogb(double x); int ilogb(long double x); int ilogb(integral x); Parameter x: It is the value whose exponent is to be calculated. Return value Parameter Return value x=0 -INT_MIN x=NAN or +inf or...
1 min read
C++ Math tan() The function finds the tangent of an angle specified in terms of radian. Syntax Consider a radian 'x'. Syntax would be: float tan(float x); double tan(double x); long double tan(long double x); double tan(integral x); Note: If the value passed is an integral type, then it is cast to double. Parameter x:...
1 min read
C++ Math abs() The function finds the absolute value of a given number. Suppose a number is 'x': abs(x) = |x|; Difference between abs() and fabs() The abs() function does not support float or double type arguments while fabs() function supports float, double as well as integer type arguments. Syntax int abs( int...
1 min read
C++ Math signbit() The function checks whether the sign of a given number is negative or not. If the sign of a number is negative, it returns 1 otherwise 0. The signbit() function can also be applied to infinite, NAN and zero value. Syntax Suppose a number is 'x'.Syntax would...
2 min read
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
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