C++ Math cosh()30 Aug 2024 | 1 min read The function finds the hyperbolic cosine of an angle given in radian. Mathematically, coshx = ex+ e-x/2 SyntaxSuppose the hyperbolic angle is 'x': Parameterx: The value of angle whose hyperbolic cosine is to be calculated. Return valueIt returns the hyperbolic cosine of angle given in radian. Example 1Let's see a simple example when the value of x is of integral type. Output: Value of degree is :45 cosh(radian): 1.32426 In this example, cosh() computes the hyperbolic cosine of an angle 45 and returns the value 1.324. Example 2Let's see another simple example. Output: Value of degree is: 25.5 cosh(radian): 1.10058 Next TopicC++ Math Functions |
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
C++ Math log() The function is used to find the natural logarithm (base-e logarithm) of a given number. Mathematically: Suppose 'x' is a given number: logex = log(x); Syntax float log(float x); double log(double x); long double log(long double x); double log(integral x); Parameter x: It is the value whose natural logarithm is to be calculated. Return...
2 min read
C++ Math log1p() The function computes the natural logarithm of a given number plus one. Suppose a number is 'x': log1p(x) = log(1+x); Syntax float log1p(float x); double log1p(double x); long double log1p(long double x); double log1p(integral x); Note: The return_type can be float, double or long double. Parameter x: The value of which logarithm is to...
2 min read
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
C++ Math erf() The erf() function computes the error function value of a parameter passed to the function. Syntax Suppose a number is 'x': float erf( float x); double erf( double x); long double erf( long double x); double erf( integral x); Parameter x: It is a floating point value. Return value It returns the error function...
2 min read
C++ Math scalbln() The function computes the product of a given number and FLT_RADX raised to the power of exponent. Suppose a number is 'x' and exponent is 'n': scalbn(x,n) = x * ( FLT_RADX)n Syntax float scalbln(float x, long int n); double scalbln(double x, long int n); long double scalbln(long double x,...
1 min read
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
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
C++ Math expm1() The function computes the exponential 'e' raised to the power a given number minus 1. Suppose a number is 'x' expm1(x) = e<sup>x</sup> - 1; Syntax float expm1(float x); double expm1(double x); long double expm1(long double x); double expm1(integral x); Note: The return_type can be float, double or long double. Parameter x: It...
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
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