ldexp

Math.ldexp(flt, int) â float Class Public methods Returns the value of flt*(2**int). fraction, exponent = Math.frexp(1234) Math.ldexp(fraction, exponent) #=> 1234.0

hypot

Math.hypot(x, y) â float Class Public methods Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with sides x and y. Math.hypot(3, 4) #=> 5.0

gamma

Math.gamma(x) â float Class Public methods Calculates the gamma function of x. Note that gamma(n) is same as fact(n-1) for integer n > 0. However gamma(n) returns float and can be an approximation. def fact(n) (1..n).inject(1) {|r,i| r*i } end 1.upto(26) {|i| p [i, Math.gamma(i), fact(i-1)] } #=> [1, 1.0, 1] # [2, 1.0, 1] # [3, 2.0, 2] # [4, 6.0, 6] # [5, 24.0, 24] # [6, 120.0, 120] # [7, 720.0, 720] # [8, 5040.0, 5040] # [9, 40320.0, 40320] # [10, 362880.

frexp

Math.frexp(numeric) â [ fraction, exponent ] Class Public methods Returns a two-element array containing the normalized fraction (a Float) and exponent (a Fixnum) of numeric. fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] fraction * 2**exponent #=> 1234.0

exp

Math.exp(x) â float Class Public methods Returns e**x. Math.exp(0) #=> 1.0 Math.exp(1) #=> 2.718281828459045 Math.exp(1.5) #=> 4.4816890703380645

erfc

Math.erfc(x) â float Class Public methods Calculates the complementary error function of x.

erf

Math.erf(x) â float Class Public methods Calculates the error function of x.

cosh

Math.cosh(x) â float Class Public methods Computes the hyperbolic cosine of x (expressed in radians).

cos

Math.cos(x) â float Class Public methods Computes the cosine of x (expressed in radians). Returns -1..1.

cbrt

Math.cbrt(numeric) â float Class Public methods Returns the cube root of numeric. -9.upto(9) {|x| p [x, Math.cbrt(x), Math.cbrt(x)**3] } #=> [-9, -2.0800838230519, -9.0] [-8, -2.0, -8.0] [-7, -1.91293118277239, -7.0] [-6, -1.81712059283214, -6.0] [-5, -1.7099759466767, -5.0] [-4, -1.5874010519682, -4.0] [-3, -1.44224957030741, -3.0] [-2, -1.25992104989487, -2.0] [-1, -1.0, -1.0] [0, 0.0, 0.0] [1, 1.0, 1.0] [2, 1.25992104989487, 2.0] [3, 1.44224957030741, 3.0] [4, 1.5874010