Ruby | Math lgamma() function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The lgamma() function in Ruby returns two numbers, one represents the logarithmic gamma of value while the other signifies the sign of gamma of value. Syntax: Math.lgamma(value) Parameter: The function takes one mandatory parameter value whose logarithmic gamma is returned and its sign. Return Value: The function returns two numbers, where one represents the logarithmic gamma of value while the other signifies the sign of gamma of value. Example 1: CPP # Ruby program for lgamma() function # Assigning values val1 = 132 val2 = 0 val3 = -23 val4 = 1 # Prints the value returned by lgamma() puts Math.lgamma(val1) puts puts Math.lgamma(val2) puts puts Math.lgamma(val3) puts puts Math.lgamma(val4) Output: 511.00802266523596 1 Infinity 1 Infinity 1 0.0 1 Example 2: CPP # Ruby program for lgamma() function # Assigning values val1 = -1 val2 = 2 val3 = -2 val4 = -9 # Prints the value returned by lgamma() puts Math.lgamma(val1) puts puts Math.lgamma(val2) puts puts Math.lgamma(val3) puts puts Math.lgamma(val4) Output: Infinity 1 0.0 1 Infinity 1 Infinity 1 Reference: https://devdocs.io/ruby~2.5/math#method-c-lgamma Comment More infoAdvertise with us Next Article Ruby | Math lgamma() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Math-class Similar Reads Ruby | Math log() function The log() function in Ruby returns the logarithm value of X. The second parameter is the base given by the user to which the logarithm value is returned. In case its not given, then the default base is e. Syntax: Math.log(X, base) Parameter: The function takes one mandatory parameter X whose logarit 1 min read Ruby | Math log2() function The log2() function in Ruby returns the base 2 logarithm value of X. Syntax: Math.log2(X) Parameter: The function takes one mandatory parameter X whose base 2 logarithm value is to be returned. Return Value: The function the base 2 logarithm value of X. Example 1: CPP # Ruby program for log2() funct 1 min read Ruby | Math log10() function The log10() function in Ruby returns the base 10 logarithm value of X. Syntax: Math.log10(X) Parameter: The function takes one mandatory parameter X whose base 10 logarithm value is to be returned. Return Value: The function the base 10 logarithm value of X. Example 1: CPP # Ruby program for log10() 1 min read Ruby | Math ldexp() function The ldexp() function in Ruby returns the value of fraction * (2^exponent) when fraction and exponent are given as parameters. The fraction is a float value and the exponent is an integer. Syntax: Math.ldexp(fraction, exponent) Parameter: The function takes two mandatory parameter fraction and expone 1 min read Ruby | Math hypot() function The hypot() function in Ruby returns sqrt(l^2 + b^2) when l and b are given as parameters. It eventually returns the hypotenuse of a right-angled triangle with sides l and b. Syntax: Math.hypot(l, b) Parameter: The function takes two mandatory parameter l and b which specifies the length and the bas 1 min read Like