Package org.jruby
Class RubyMath
java.lang.Object
org.jruby.RubyMath
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Inner class to help with Γ functions -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double[]
static final double[]
static final double[]
static final double[]
static final double[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RubyFloat
acos
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
acosh
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
asin
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
asinh
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
atan
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
atan2
(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) static RubyFloat
atanh
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
cbrt
(ThreadContext context, IRubyObject recv, IRubyObject x) static double
chebylevSerie
(double x, double[] coef) static RubyFloat
cos
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
cosh
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyModule
createMathModule
(ThreadContext context) Create the Math module and add it to the Ruby runtime.static RubyFloat
erf
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
erfc
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
exp
(ThreadContext context, IRubyObject exponent) static RubyFloat
exp
(ThreadContext context, IRubyObject recv, IRubyObject exponent) static RubyArray
frexp
(ThreadContext context, IRubyObject recv, IRubyObject other) static RubyFloat
gamma
(ThreadContext context, IRubyObject recv, IRubyObject x) Based on Gergő Nemes's Gamma Function approximation formula, we compute approximate value of Gamma function of x.static RubyFloat
hypot
(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) static RubyFloat
hypot19
(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) Deprecated.static RubyFloat
ldexp
(ThreadContext context, IRubyObject recv, IRubyObject mantissa, IRubyObject exponent) static RubyArray
lgamma
(ThreadContext context, IRubyObject recv, IRubyObject x) Based on Gergő Nemes's Gamma Function approximation formula, we compute Log Gamma function for real number x.static RubyFloat
log
(ThreadContext context, IRubyObject val) static RubyFloat
log
(ThreadContext context, IRubyObject recv, IRubyObject val) Returns the natural logarithm of x.static RubyFloat
log
(ThreadContext context, IRubyObject recv, IRubyObject... args) static RubyFloat
log
(ThreadContext context, IRubyObject recv, IRubyObject val, IRubyObject base) static RubyFloat
log10
(ThreadContext context, IRubyObject recv, IRubyObject x) Returns the base 10 logarithm of x.static RubyFloat
log2
(ThreadContext context, IRubyObject recv, IRubyObject x) Returns the base 2 logarithm of x.static double
nemes_gamma
(double x) static double
sign
(double x, double y) static RubyFloat
sin
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
sinh
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
sqrt
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
tan
(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloat
tanh
(ThreadContext context, IRubyObject recv, IRubyObject x)
-
Field Details
-
ASINH_COEF
public static final double[] ASINH_COEF -
ATANH_COEF
public static final double[] ATANH_COEF -
ERFC_COEF
public static final double[] ERFC_COEF -
ERFC2_COEF
public static final double[] ERFC2_COEF -
ERFCC_COEF
public static final double[] ERFCC_COEF
-
-
Constructor Details
-
RubyMath
public RubyMath()
-
-
Method Details
-
createMathModule
Create the Math module and add it to the Ruby runtime. -
chebylevSerie
public static double chebylevSerie(double x, double[] coef) -
sign
public static double sign(double x, double y) -
atan2
public static RubyFloat atan2(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) -
cos
-
sin
-
tan
-
asin
-
acos
-
atan
-
cosh
-
sinh
-
tanh
-
acosh
-
asinh
-
atanh
-
exp
-
exp
-
log
Returns the natural logarithm of x. -
log
-
log
public static RubyFloat log(ThreadContext context, IRubyObject recv, IRubyObject val, IRubyObject base) -
log
-
log10
Returns the base 10 logarithm of x. -
log2
Returns the base 2 logarithm of x. -
sqrt
-
cbrt
-
hypot19
@Deprecated public static RubyFloat hypot19(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) Deprecated. -
hypot
public static RubyFloat hypot(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) -
frexp
-
ldexp
public static RubyFloat ldexp(ThreadContext context, IRubyObject recv, IRubyObject mantissa, IRubyObject exponent) -
erf
-
erfc
-
gamma
Based on Gergő Nemes's Gamma Function approximation formula, we compute approximate value of Gamma function of x.- Parameters:
recv
- Math modulex
- a real number- Returns:
- Γ(x) for real number x
- See Also:
-
lgamma
Based on Gergő Nemes's Gamma Function approximation formula, we compute Log Gamma function for real number x.- Parameters:
recv
- Math modulex
- a real number- Returns:
- 2-element array [ln(Γ(x)), sgn] for real number x, where sgn is the sign of Γ(x) when exponentiated
- See Also:
-
nemes_gamma
public static double nemes_gamma(double x)
-