Package org.jruby.util
Class Numeric
java.lang.Object
org.jruby.util.Numeric
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkInteger
(ThreadContext context, IRubyObject obj) Deprecated.static RubyFloat
f_abs
(ThreadContext context, RubyFloat x) static RubyInteger
f_abs
(ThreadContext context, RubyInteger x) static IRubyObject
f_abs
(ThreadContext context, IRubyObject x) f_absstatic IRubyObject
f_abs2
(ThreadContext context, IRubyObject x) f_abs2static RubyInteger
f_add
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_add
(ThreadContext context, IRubyObject x, IRubyObject y) f_addstatic IRubyObject
f_arg
(ThreadContext context, IRubyObject x) f_argstatic RubyFixnum
f_cmp
(ThreadContext context, RubyInteger x, long y) static RubyFixnum
f_cmp
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_cmp
(ThreadContext context, IRubyObject x, IRubyObject y) f_cmpstatic IRubyObject
f_conjugate
(ThreadContext context, IRubyObject x) f_conjugatestatic IRubyObject
f_denominator
(ThreadContext context, IRubyObject x) f_denominatorstatic IRubyObject
f_div
(ThreadContext context, IRubyObject x, IRubyObject y) f_divstatic IRubyObject
f_divmod
(ThreadContext context, RubyInteger x, IRubyObject y) static IRubyObject
f_divmod
(ThreadContext context, IRubyObject x, IRubyObject y) f_divmodstatic boolean
f_eqeq_p
(ThreadContext context, IRubyObject x, IRubyObject y) static IRubyObject
f_equal
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_equal
(ThreadContext context, IRubyObject a, IRubyObject b) f_equal Note: This may not return a value which is a boolean.static boolean
f_exact_p
(ThreadContext context, IRubyObject x) f_exact_pstatic RubyNumeric
f_expt
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_expt
(ThreadContext context, IRubyObject x, IRubyObject y) f_exptstatic IRubyObject
f_floor
(ThreadContext context, IRubyObject x) f_floorstatic RubyInteger
f_gcd
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_gcd
(ThreadContext context, IRubyObject x, IRubyObject y) f_gcdstatic boolean
f_gt_p
(ThreadContext context, RubyInteger x, RubyInteger y) static boolean
f_gt_p
(ThreadContext context, IRubyObject x, IRubyObject y) f_gt_pstatic RubyInteger
f_idiv
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_idiv
(ThreadContext context, IRubyObject x, IRubyObject y) f_idivstatic IRubyObject
f_inspect
(ThreadContext context, IRubyObject x) f_inspectstatic boolean
f_integer_p
(ThreadContext context, RubyNumeric x) static boolean
f_integer_p
(ThreadContext context, IRubyObject x) f_integer_pstatic IRubyObject
f_lcm
(ThreadContext context, IRubyObject x, IRubyObject y) f_lcmstatic IRubyObject
f_lshift
(ThreadContext context, IRubyObject x, IRubyObject y) f_lshiftstatic boolean
f_lt_p
(ThreadContext context, RubyInteger x, RubyInteger y) static boolean
f_lt_p
(ThreadContext context, IRubyObject x, IRubyObject y) f_lt_pstatic boolean
f_minus_one_p
(ThreadContext context, IRubyObject x) f_minus_one_pstatic IRubyObject
f_mod
(ThreadContext context, IRubyObject x, IRubyObject y) f_modstatic RubyInteger
f_mul
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_mul
(ThreadContext context, IRubyObject x, IRubyObject y) f_mulstatic RubyInteger
f_negate
(ThreadContext context, RubyInteger x) static IRubyObject
f_negate
(ThreadContext context, IRubyObject x) f_negatestatic boolean
f_negative_p
(ThreadContext context, RubyFloat x) static boolean
f_negative_p
(ThreadContext context, RubyInteger x) static boolean
f_negative_p
(ThreadContext context, IRubyObject x) f_negative_pstatic IRubyObject
f_numerator
(ThreadContext context, IRubyObject x) f_numeratorstatic boolean
f_odd_p
(ThreadContext context, IRubyObject i) f_odd_pstatic boolean
f_one_p
(ThreadContext context, IRubyObject x) f_one_pstatic IRubyObject
f_polar
(ThreadContext context, IRubyObject x) f_polarstatic IRubyObject
f_quo
(ThreadContext context, RubyFloat x, RubyFloat y) static IRubyObject
f_quo
(ThreadContext context, IRubyObject x, IRubyObject y) f_quostatic boolean
f_real_p
(ThreadContext context, IRubyObject x) f_real_pstatic IRubyObject
f_reciprocal
(ThreadContext context, IRubyObject x) MRI: f_reciprocalstatic IRubyObject
f_rshift
(ThreadContext context, IRubyObject x, IRubyObject y) f_rshiftstatic RubyInteger
f_sub
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_sub
(ThreadContext context, IRubyObject x, IRubyObject y) f_substatic IRubyObject
f_to_f
(ThreadContext context, IRubyObject x) f_to_fstatic IRubyObject
f_to_i
(ThreadContext context, IRubyObject x) f_to_istatic RubyNumeric
f_to_r
(ThreadContext context, RubyInteger x) static IRubyObject
f_to_r
(ThreadContext context, IRubyObject x) f_to_rstatic IRubyObject
f_to_s
(ThreadContext context, IRubyObject x) f_to_sstatic IRubyObject
f_truncate
(ThreadContext context, IRubyObject x) f_truncatestatic IRubyObject
f_xor
(ThreadContext context, RubyInteger x, RubyInteger y) static IRubyObject
f_xor
(ThreadContext context, IRubyObject x, IRubyObject y) f_xorstatic boolean
f_zero_p
(ThreadContext context, RubyInteger x) static boolean
f_zero_p
(ThreadContext context, IRubyObject x) f_zero_pstatic double
frexp
(double mantissa, long[] e) static long
i_gcd
(long x, long y) i_gcdstatic long
i_ilog2
(ThreadContext context, RubyInteger x) static long
i_ilog2
(ThreadContext context, IRubyObject x) static RubyNumeric
int_pow
(ThreadContext context, long x, long y) protected static boolean
Check if the Fixnum passed is equal to Long.MAX_VALUE.static boolean
static boolean
k_exact_zero_p
(ThreadContext context, IRubyObject x) MRI: k_exact_zero_pstatic boolean
static boolean
static boolean
static double
ldexp
(double f, long e) static boolean
multiplyOverflows
(long a, long b) static IRubyObject
num_pow
(ThreadContext context, IRubyObject x, IRubyObject y) static IRubyObject[]
nurat_rationalize_internal
(ThreadContext context, IRubyObject[] ary) static IRubyObject[]
nurat_rationalize_internal
(ThreadContext context, IRubyObject a, IRubyObject b) static long
rotl
(long bits, int rot) Rotate the given long bits left.static long
rotr
(long bits, int rot) Rotate the given long bits right.static IRubyObject
safe_mul
(ThreadContext context, IRubyObject a, IRubyObject b, boolean az, boolean bz)
-
Field Details
-
CANON
public static final boolean CANON- See Also:
-
-
Constructor Details
-
Numeric
public Numeric()
-
-
Method Details
-
f_add
f_add -
f_add
-
f_cmp
f_cmp -
f_cmp
-
f_cmp
-
f_div
f_div -
f_gt_p
f_gt_p -
f_gt_p
-
f_lt_p
f_lt_p -
f_lt_p
-
f_mod
f_mod -
f_mul
f_mul -
f_mul
-
safe_mul
public static IRubyObject safe_mul(ThreadContext context, IRubyObject a, IRubyObject b, boolean az, boolean bz) -
f_sub
f_sub -
f_sub
-
f_xor
f_xor -
f_xor
-
f_abs
f_abs -
f_abs
-
f_abs
-
f_abs2
f_abs2 -
f_arg
f_arg -
f_conjugate
f_conjugate -
f_denominator
f_denominator -
f_exact_p
f_exact_p -
f_numerator
f_numerator -
f_polar
f_polar -
f_real_p
f_real_p -
f_integer_p
f_integer_p -
f_integer_p
-
f_divmod
f_divmod -
f_divmod
-
f_floor
f_floor -
f_inspect
f_inspect -
f_negate
f_negate -
f_negate
-
f_to_f
f_to_f -
f_to_i
f_to_i -
f_to_r
f_to_r -
f_to_r
-
f_to_s
f_to_s -
f_truncate
f_truncate -
f_equal
f_equal Note: This may not return a value which is a boolean. other.== can return non-boolean (which unless it is nil it will be isTrue()). -
f_equal
-
f_expt
f_expt -
f_expt
-
f_idiv
f_idiv -
f_idiv
-
f_quo
f_quo -
f_quo
-
f_reciprocal
MRI: f_reciprocal -
f_rshift
f_rshift -
f_lshift
f_lshift -
f_negative_p
f_negative_p -
f_negative_p
-
f_negative_p
-
f_zero_p
f_zero_p -
f_zero_p
-
f_one_p
f_one_p -
f_minus_one_p
f_minus_one_p -
f_odd_p
f_odd_p -
i_gcd
public static long i_gcd(long x, long y) i_gcd -
f_gcd
f_gcd -
f_gcd
-
isLongMinValue
Check if the Fixnum passed is equal to Long.MAX_VALUE.- Parameters:
x
- the Fixnum to compare- Returns:
- true if it is equal to Long.MAX_VALUE, false otherwise.
-
f_lcm
f_lcm -
i_ilog2
-
i_ilog2
-
ldexp
public static double ldexp(double f, long e) -
frexp
public static double frexp(double mantissa, long[] e) -
int_pow
-
num_pow
-
multiplyOverflows
public static boolean multiplyOverflows(long a, long b) -
k_exact_p
-
k_exact_zero_p
MRI: k_exact_zero_p -
k_inexact_p
-
k_integer_p
-
k_numeric_p
-
rotl
public static long rotl(long bits, int rot) Rotate the given long bits left.- Parameters:
bits
- the bits to rotaterot
- how many bit positions to rotate- Returns:
- the rotated value
-
rotr
public static long rotr(long bits, int rot) Rotate the given long bits right.- Parameters:
bits
- the bits to rotaterot
- how many bit positions to rotate- Returns:
- the rotated value
-
nurat_rationalize_internal
public static IRubyObject[] nurat_rationalize_internal(ThreadContext context, IRubyObject a, IRubyObject b) -
nurat_rationalize_internal
-
f_eqeq_p
-
checkInteger
Deprecated.
-