Codota Logo
RubyBignum.fix2big
Code IndexAdd Codota 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)

  • Common ways to obtain RubyBignum
private void myMethod () {
RubyBignum r =
  • Codota IconRubyRandom.RandomType rubyRandomRandomType;rubyRandomRandomType.getState()
  • Codota IconRuby runtime;String value;new RubyBignum(runtime, new BigInteger(value))
  • Codota IconRuby runtime;RubyBignum.newBignum(runtime, value)
  • Smart code suggestions by Codota
}
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: 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_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
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now