congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
RubyBignum.fix2big
Code IndexAdd Tabnine to your IDE (free)

How to use
fix2big
method
in
org.jruby.RubyBignum

Best Java code snippets using org.jruby.RubyBignum.fix2big (Showing top 20 results out of 315)

origin: org.jruby/jruby-complete

final RubyInteger op_and(ThreadContext context, RubyFixnum other) {
  return bignorm(context.runtime, value.and(fix2big(other)));
}
origin: org.jruby/jruby-core

final RubyInteger op_and(ThreadContext context, RubyFixnum other) {
  return bignorm(context.runtime, value.and(fix2big(other)));
}
origin: org.jruby/jruby-complete

final RubyInteger op_or(ThreadContext context, RubyFixnum other) {
  return bignorm(context.runtime, value.or(fix2big(other))); // no bignorm here needed
}
origin: org.jruby/jruby-core

final RubyInteger op_or(ThreadContext context, RubyFixnum other) {
  return bignorm(context.runtime, value.or(fix2big(other))); // no bignorm here needed
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_modulo
 *
 */
@JRubyMethod(name = {"%", "modulo"}, required = 1, compat = RUBY1_8)
public IRubyObject op_mod(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else {
    return coerceBin(context, "%", other);
  }
  Ruby runtime = context.runtime;
  if (otherValue.signum() == 0) throw runtime.newZeroDivisionError();
  BigInteger result = value.mod(otherValue.abs());
  if (otherValue.signum() == -1 && result.signum() != 0) result = otherValue.add(result);
  return bignorm(runtime, result);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_modulo
 *
 */
@JRubyMethod(name = {"%", "modulo"}, required = 1, compat = RUBY1_8)
public IRubyObject op_mod(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else {
    return coerceBin(context, "%", other);
  }
  Ruby runtime = context.runtime;
  if (otherValue.signum() == 0) throw runtime.newZeroDivisionError();
  BigInteger result = value.mod(otherValue.abs());
  if (otherValue.signum() == -1 && result.signum() != 0) result = otherValue.add(result);
  return bignorm(runtime, result);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "*", required = 1, compat = RUBY1_9)
public IRubyObject op_mul19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  BigInteger result;
  if (other instanceof RubyFixnum) {
    return bignorm(runtime, value.multiply(fix2big(((RubyFixnum) other))));
  } else if (other instanceof RubyBignum) {
    return bignorm(runtime, value.multiply(((RubyBignum)other).value));
  } else return opMulOther(context, other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "*", required = 1, compat = RUBY1_9)
public IRubyObject op_mul19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  BigInteger result;
  if (other instanceof RubyFixnum) {
    return bignorm(runtime, value.multiply(fix2big(((RubyFixnum) other))));
  } else if (other instanceof RubyBignum) {
    return bignorm(runtime, value.multiply(((RubyBignum)other).value));
  } else return opMulOther(context, other);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_mul
 *
 */
@JRubyMethod(name = "*", required = 1)
public IRubyObject op_mul(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    BigInteger result = value.multiply(fix2big(((RubyFixnum) other)));
    return result.signum() == 0 ? RubyFixnum.zero(runtime) : new RubyBignum(runtime, result);
  }
  if (other instanceof RubyBignum) {
    BigInteger result = value.multiply(((RubyBignum)other).value);
    return result.signum() == 0 ? RubyFixnum.zero(runtime) : new RubyBignum(runtime, result);
  } else return opMulOther(context, other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_mul
 *
 */
@JRubyMethod(name = "*", required = 1)
public IRubyObject op_mul(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    BigInteger result = value.multiply(fix2big(((RubyFixnum) other)));
    return result.signum() == 0 ? RubyFixnum.zero(runtime) : new RubyBignum(runtime, result);
  }
  if (other instanceof RubyBignum) {
    BigInteger result = value.multiply(((RubyBignum)other).value);
    return result.signum() == 0 ? RubyFixnum.zero(runtime) : new RubyBignum(runtime, result);
  } else return opMulOther(context, other);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_remainder
 *
 */
@JRubyMethod(name = "remainder", required = 1, compat = RUBY1_8)
@Override
public IRubyObject remainder(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big(((RubyFixnum) other));
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else {
    return coerceBin(context, "remainder", other);
  }
  Ruby runtime = context.runtime;
  if (otherValue.signum() == 0) throw runtime.newZeroDivisionError();
  return bignorm(runtime, value.remainder(otherValue));
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_remainder
 *
 */
@JRubyMethod(name = "remainder", required = 1, compat = RUBY1_8)
@Override
public IRubyObject remainder(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big(((RubyFixnum) other));
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else {
    return coerceBin(context, "remainder", other);
  }
  Ruby runtime = context.runtime;
  if (otherValue.signum() == 0) throw runtime.newZeroDivisionError();
  return bignorm(runtime, value.remainder(otherValue));
}
origin: org.jruby/jruby-complete

/** rb_big_eq
 *
 */
@Override
public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    double a = ((RubyFloat) other).getDoubleValue();
    if (Double.isNaN(a)) {
      return context.fals;
    }
    return RubyBoolean.newBoolean(context.runtime, a == big2dbl(this));
  } else {
    return other.op_eqq(context, this);
  }
  return RubyBoolean.newBoolean(context.runtime, value.compareTo(otherValue) == 0);
}
origin: org.jruby/jruby-core

/** rb_big_eq
 *
 */
@Override
public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    double a = ((RubyFloat) other).getDoubleValue();
    if (Double.isNaN(a)) {
      return context.fals;
    }
    return RubyBoolean.newBoolean(context.runtime, a == big2dbl(this));
  } else {
    return other.op_eqq(context, this);
  }
  return RubyBoolean.newBoolean(context.runtime, value.compareTo(otherValue) == 0);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_and
 *
 */
@JRubyMethod(name = "&", required = 1, compat = RUBY1_8)
public IRubyObject op_and(ThreadContext context, IRubyObject other) {
  other = other.convertToInteger();
  if (other instanceof RubyBignum) {
    return bignorm(getRuntime(), value.and(((RubyBignum) other).value));
  } else if (other instanceof RubyFixnum) {
    return bignorm(getRuntime(), value.and(fix2big((RubyFixnum)other)));
  }
  return coerceBin(context, "&", other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_and
 *
 */
@JRubyMethod(name = "&", required = 1, compat = RUBY1_8)
public IRubyObject op_and(ThreadContext context, IRubyObject other) {
  other = other.convertToInteger();
  if (other instanceof RubyBignum) {
    return bignorm(getRuntime(), value.and(((RubyBignum) other).value));
  } else if (other instanceof RubyFixnum) {
    return bignorm(getRuntime(), value.and(fix2big((RubyFixnum)other)));
  }
  return coerceBin(context, "&", other);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_or
 *
 */
@JRubyMethod(name = "|", required = 1, compat = RUBY1_8)
public IRubyObject op_or(ThreadContext context, IRubyObject other) {
  other = other.convertToInteger();
  if (other instanceof RubyBignum) {
    return bignorm(getRuntime(), value.or(((RubyBignum) other).value));
  }
  if (other instanceof RubyFixnum) { // no bignorm here needed
    return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other)));
  }
  return coerceBin(context, "|", other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_or
 *
 */
@JRubyMethod(name = "|", required = 1, compat = RUBY1_8)
public IRubyObject op_or(ThreadContext context, IRubyObject other) {
  other = other.convertToInteger();
  if (other instanceof RubyBignum) {
    return bignorm(getRuntime(), value.or(((RubyBignum) other).value));
  }
  if (other instanceof RubyFixnum) { // no bignorm here needed
    return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other)));
  }
  return coerceBin(context, "|", other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private IRubyObject powerOther19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  long a = value;
  if (other instanceof RubyBignum) {
    if (other.callMethod(context, "<", RubyFixnum.zero(runtime)).isTrue()) {
      return RubyRational.newRationalRaw(runtime, this).callMethod(context, "**", other);
    }
    if (a == 0) return RubyFixnum.zero(runtime);
    if (a == 1) return RubyFixnum.one(runtime);
    if (a == -1) {
      return ((RubyBignum)other).even_p(context).isTrue() ? RubyFixnum.one(runtime) : RubyFixnum.minus_one(runtime);
    }
    RubyBignum.newBignum(runtime, RubyBignum.fix2big(this)).op_pow(context, other);
  } else if (other instanceof RubyFloat) {
    double b = ((RubyFloat)other).getValue();
    if (b == 0.0 || a == 1) return runtime.newFloat(1.0);
    if (a == 0) return runtime.newFloat(b < 0 ? 1.0 / 0.0 : 0.0);
    return RubyFloat.newFloat(runtime, Math.pow(a, b));
  }
  return coerceBin(context, "**", other);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

private IRubyObject powerOther19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  long a = value;
  if (other instanceof RubyBignum) {
    if (other.callMethod(context, "<", RubyFixnum.zero(runtime)).isTrue()) {
      return RubyRational.newRationalRaw(runtime, this).callMethod(context, "**", other);
    }
    if (a == 0) return RubyFixnum.zero(runtime);
    if (a == 1) return RubyFixnum.one(runtime);
    if (a == -1) {
      return ((RubyBignum)other).even_p(context).isTrue() ? RubyFixnum.one(runtime) : RubyFixnum.minus_one(runtime);
    }
    RubyBignum.newBignum(runtime, RubyBignum.fix2big(this)).op_pow(context, other);
  } else if (other instanceof RubyFloat) {
    double b = ((RubyFloat)other).getValue();
    if (b == 0.0 || a == 1) return runtime.newFloat(1.0);
    if (a == 0) return runtime.newFloat(b < 0 ? 1.0 / 0.0 : 0.0);
    return RubyFloat.newFloat(runtime, Math.pow(a, b));
  }
  return coerceBin(context, "**", other);
}
org.jrubyRubyBignumfix2big

Javadoc

rb_int2big

Popular methods of RubyBignum

  • newBignum
  • getLongValue
  • getValue
    Getter for property value.
  • <init>
  • addFloat
  • addOther
  • big2dbl
    rb_big2dbl
  • big2long
    rb_big2long
  • bignorm
    rb_big_norm
  • checkShiftDown
  • coerceBin
  • coerceCmp
  • coerceBin,
  • coerceCmp,
  • compareTo,
  • convertToDouble,
  • createBignumClass,
  • dbl_cmp,
  • divmod,
  • even_p,
  • getBigIntegerValue

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • Kernel (java.awt.image)
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BoxLayout (javax.swing)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now