Package org.jruby
Class RubyMath
java.lang.Object
org.jruby.RubyMath
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner 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 RubyFloatacos(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatacosh(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatasin(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatasinh(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatatan(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatatan2(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) static RubyFloatatanh(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatcbrt(ThreadContext context, IRubyObject recv, IRubyObject x) static doublechebylevSerie(double x, double[] coef) static RubyFloatcos(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatcosh(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyModulecreateMathModule(ThreadContext context) Create the Math module and add it to the Ruby runtime.static RubyFloaterf(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloaterfc(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatexp(ThreadContext context, IRubyObject exponent) static RubyFloatexp(ThreadContext context, IRubyObject recv, IRubyObject exponent) static RubyArrayfrexp(ThreadContext context, IRubyObject recv, IRubyObject other) static RubyFloatgamma(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 RubyFloathypot(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) static RubyFloathypot19(ThreadContext context, IRubyObject recv, IRubyObject x, IRubyObject y) Deprecated.static RubyFloatldexp(ThreadContext context, IRubyObject recv, IRubyObject mantissa, IRubyObject exponent) static RubyArraylgamma(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 RubyFloatlog(ThreadContext context, IRubyObject val) static RubyFloatlog(ThreadContext context, IRubyObject recv, IRubyObject val) Returns the natural logarithm of x.static RubyFloatlog(ThreadContext context, IRubyObject recv, IRubyObject... args) static RubyFloatlog(ThreadContext context, IRubyObject recv, IRubyObject val, IRubyObject base) static RubyFloatlog10(ThreadContext context, IRubyObject recv, IRubyObject x) Returns the base 10 logarithm of x.static RubyFloatlog2(ThreadContext context, IRubyObject recv, IRubyObject x) Returns the base 2 logarithm of x.static doublenemes_gamma(double x) static doublesign(double x, double y) static RubyFloatsin(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatsinh(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloatsqrt(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloattan(ThreadContext context, IRubyObject recv, IRubyObject x) static RubyFloattanh(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)
-