C++ Math tgamma()30 Aug 2024 | 2 min read The tgamma() function computes the gamma function of an argument passed to the function. Suppose a number is x: ![]() SyntaxParameterx: It is a floating point value. Return valueIt returns the gamma function value of x.
Example 1Let's see the simple example when the value of x is zero. Output: Value of x is : 0 tgamma(x) : inf In the above example, the value of x is zero.Therefore, the function tgamma() returns +∞. Example 2Let's see the simple example when the value of x is negative. Output: Value of x is : -6 tgamma(x) : nan In the above example, the value of x is a negative integer. Therefore, the function tgamma() returns nan. Example 3Let's see the simple example when the value of x is -∞. Output: Value of x is : -inf tgamma(x): nan In the above example, the value of x -∞. Therefore, the function tgamma() returns nan. Example 4Let's see the simple example when the value of is +∞. Output: Value of x is : inf tgamma(x) : inf In the above example, the value of x is +∞. Therefore, the function tgamma() returns +∞. Example 5Let's see the simple example when the value of x is nan. Output: Value of x is : -nan tgamma(x) : -nan In the above example, the value of x is nan. Therefore, the function tgamma() returns nan. Next TopicC++ Math Functions |
C++ Math log2() The function computes the base 2 logarithm of a given number. Suppose a number is 'x': log2(x) = log2x; Syntax float log2(float x); double log2(double x); long double log2(long double x); double log2(integral x); Note: The return_type can be float, double or long double. Parameter x: The value whose logarithm is to be...
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 after() The after() function represents the representable value in a specific direction. Suppose two numbers are 'from' and 'to'. Therefore, the after() function finds the value of 'from' in the direction of 'to'. Syntax float after( float from, float to); double after( double from, double to); long double...
2 min read
C++ Math asinh() The function computes the arc hyperbolic sine of an angle given in radian. Where, an arc of hyperbolic sine is the inverse of hyperbolic sine. sinh-1x = asinh(x); Syntax Suppose an angle given in radian is 'x': float asinh(float x); double asinh(double x); long double asinh(long double x); double asinh(integral x); Parameter x: The...
1 min read
C++ Math tanh() The function computes the hyperbolic tangent of an angle given in radian. Mathematically, tanhx = ex -e-x/ ex+e-x Syntax Suppose the angle is 'x': float tanh(float x); double tanh(double x); long double tanh(long double x); double tanh(integral x); Parameter x: The value whose hyperbolic tangent is to be computed. Return value It returns the hyperbolic tangent...
1 min read
C++ Math remquo() The function finds the floating point remainder of numerator/denominator (rounded to the nearest integer value) and it also stores the quotient internally to the pointer passed in the parameter of the function. Syntax Suppose a numerator be 'n', denominator be 'd' and pointer 'p'. Syntax would...
1 min read
C++ Math scalbn() 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 scalbn(float x, int n); double scalbn(double x, int n); long double scalbn(long double x, int n); double...
1 min read
C++ Math round() This function is used to round off the given value which can be either float or double. For example: round(5.8)= 6; round(-1.1)= -1; Syntax Suppose a number is 'x'. Syntax would be: return_type round(data_type x); Parameter x : The value which can be either float or double. Return value It returns the rounded value...
1 min read
C++ Math islessgreater() The islessgreater() fuinction determines whether the value of first argument is less than or greater than the value of second argument. If the value of first argument is less than or greater than the second argument then it returns 1 otherwise 0. Note: If one...
2 min read
C++ Math rint() The function rounds off the given value to the nearest integer using current rounding mode. The current rounding mode is determined by fesetround(). For example: rint(7.9) = 8; if, fesetround(FE_DOWNWARD) then, rint(7.9) = 7; Syntax Suppose a number 'x'. Syntax would be: return_type rint(data_type x); Note: The return_type can be float, double...
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