congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RubyBignum.getBigIntegerValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getBigIntegerValue
method
in
org.jruby.RubyBignum

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

origin: org.jruby/jruby-complete

public static Random randomFromBignum(RubyBignum seed) {
  BigInteger big = seed.getBigIntegerValue();
  return randomFromBigInteger(big);
}
origin: org.jruby/jruby-core

public static Random randomFromBignum(RubyBignum seed) {
  BigInteger big = seed.getBigIntegerValue();
  return randomFromBigInteger(big);
}
origin: org.jruby/jruby-core

private static RubyBigDecimal newInstance(Ruby runtime, IRubyObject recv, RubyBignum arg, MathContext mathContext) {
  final BigInteger value = arg.getBigIntegerValue();
  if (value.equals(BigInteger.ZERO)) return newZero(runtime, 1);
  return new RubyBigDecimal(runtime, (RubyClass) recv, new BigDecimal(value, mathContext));
}
origin: org.jruby/jruby-complete

private static RubyBigDecimal newInstance(Ruby runtime, IRubyObject recv, RubyBignum arg, MathContext mathContext) {
  final BigInteger value = arg.getBigIntegerValue();
  if (value.equals(BigInteger.ZERO)) return newZero(runtime, 1);
  return new RubyBigDecimal(runtime, (RubyClass) recv, new BigDecimal(value, mathContext));
}
origin: org.jruby/jruby-core

private static boolean isEven(final RubyNumeric x) {
  if (x instanceof RubyFixnum) return (((RubyFixnum) x).getLongValue() & 1) == 0;
  if (x instanceof RubyBignum) {
    return ((RubyBignum) x).getBigIntegerValue().testBit(0) == false; // 0-th bit -> 0
  }
  return false;
}
origin: org.jruby/jruby-complete

private static boolean isEven(final RubyNumeric x) {
  if (x instanceof RubyFixnum) return (((RubyFixnum) x).getLongValue() & 1) == 0;
  if (x instanceof RubyBignum) {
    return ((RubyBignum) x).getBigIntegerValue().testBit(0) == false; // 0-th bit -> 0
  }
  return false;
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

RandomType(IRubyObject vseed, RubyBignum state, int left) {
  this.seed = vseed.convertToInteger();
  byte[] bytes = state.getBigIntegerValue().toByteArray();
  int[] ints = new int[bytes.length / 4];
  for (int i = 0; i < ints.length; ++i) {
    ints[i] = getIntBigIntegerBuffer(bytes, i);
  }
  this.mt = new Random(ints, left);
}
origin: org.jruby/jruby-core

RandomType(IRubyObject vseed, RubyBignum state, int left) {
  this.seed = vseed.convertToInteger();
  byte[] bytes = state.getBigIntegerValue().toByteArray();
  int[] ints = new int[bytes.length / 4];
  for (int i = 0; i < ints.length; ++i) {
    ints[i] = getIntBigIntegerBuffer(bytes, i);
  }
  this.impl = new Random(ints, left);
}
origin: org.jruby/jruby-complete

RandomType(IRubyObject vseed, RubyBignum state, int left) {
  this.seed = vseed.convertToInteger();
  byte[] bytes = state.getBigIntegerValue().toByteArray();
  int[] ints = new int[bytes.length / 4];
  for (int i = 0; i < ints.length; ++i) {
    ints[i] = getIntBigIntegerBuffer(bytes, i);
  }
  this.impl = new Random(ints, left);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

RandomType(IRubyObject vseed, RubyBignum state, int left) {
  this.seed = vseed.convertToInteger();
  byte[] bytes = state.getBigIntegerValue().toByteArray();
  int[] ints = new int[bytes.length / 4];
  for (int i = 0; i < ints.length; ++i) {
    ints[i] = getIntBigIntegerBuffer(bytes, i);
  }
  this.mt = new Random(ints, left);
}
origin: org.jruby/jruby-core

protected IRubyObject intPowTmp3(ThreadContext context, RubyInteger y, RubyBignum m, boolean negaFlg) {
  Ruby runtime = context.runtime;
  BigInteger xn, yn, mn, zn;
  if (this instanceof RubyFixnum) {
    xn = BigInteger.valueOf(this.getLongValue());
  } else {
    xn = this.getBigIntegerValue();
  }
  if (y instanceof RubyFixnum) {
    yn = BigInteger.valueOf(y.getLongValue());
  } else {
    yn = y.getBigIntegerValue();
  }
  mn = m.getBigIntegerValue();
  zn = xn.modPow(yn, mn);
  if (negaFlg & zn.signum() == 1) {
    zn = zn.negate();
  }
  return RubyBignum.bignorm(runtime, zn);
}
origin: org.jruby/jruby-complete

protected IRubyObject intPowTmp3(ThreadContext context, RubyInteger y, RubyBignum m, boolean negaFlg) {
  Ruby runtime = context.runtime;
  BigInteger xn, yn, mn, zn;
  if (this instanceof RubyFixnum) {
    xn = BigInteger.valueOf(this.getLongValue());
  } else {
    xn = this.getBigIntegerValue();
  }
  if (y instanceof RubyFixnum) {
    yn = BigInteger.valueOf(y.getLongValue());
  } else {
    yn = y.getBigIntegerValue();
  }
  mn = m.getBigIntegerValue();
  zn = xn.modPow(yn, mn);
  if (negaFlg & zn.signum() == 1) {
    zn = zn.negate();
  }
  return RubyBignum.bignorm(runtime, zn);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static IRubyObject randLimitedBignum(ThreadContext context, RandomType random,
    RubyBignum limit) {
  byte[] buf = limit.getBigIntegerValue().toByteArray();
  byte[] bytes = new byte[buf.length];
  int len = (buf.length + 3) / 4;
origin: com.ning.billing/killbill-osgi-bundles-jruby

private static IRubyObject randLimitedBignum(ThreadContext context, RandomType random,
    RubyBignum limit) {
  byte[] buf = limit.getBigIntegerValue().toByteArray();
  byte[] bytes = new byte[buf.length];
  int len = (buf.length + 3) / 4;
origin: com.ning.billing/killbill-osgi-bundles-jruby

BigInteger big = ((RubyBignum) seed).getBigIntegerValue();
if (big.signum() < 0) {
  big = big.abs();
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

BigInteger big = ((RubyBignum) seed).getBigIntegerValue();
if (big.signum() < 0) {
  big = big.abs();
origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"concat", "<<"}, compat = RUBY1_9)
public RubyString concat19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    int c = RubyNumeric.num2int(other);
    if (c < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    return concatNumeric(runtime, c);
  } else if (other instanceof RubyBignum) {
    if (((RubyBignum) other).getBigIntegerValue().signum() < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    long c = ((RubyBignum) other).getLongValue();
    return concatNumeric(runtime, (int) c);
  }
  
  if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String");
  return append19(other);
}
origin: org.jruby/jruby-complete

/** rb_str_concat
 *
 */
@JRubyMethod(name = "<<")
public RubyString concatSingle(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    long c = RubyNumeric.num2long(other);
    if (c < 0) {
      throw runtime.newRangeError(c + " out of char range");
    }
    return concatNumeric(runtime, (int)(c & 0xFFFFFFFF));
  } else if (other instanceof RubyBignum) {
    if (((RubyBignum) other).getBigIntegerValue().signum() < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    long c = ((RubyBignum) other).getLongValue();
    return concatNumeric(runtime, (int) c);
  }
  if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String");
  return append19(other);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"concat", "<<"}, compat = RUBY1_9)
public RubyString concat19(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    int c = RubyNumeric.num2int(other);
    if (c < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    return concatNumeric(runtime, c);
  } else if (other instanceof RubyBignum) {
    if (((RubyBignum) other).getBigIntegerValue().signum() < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    long c = ((RubyBignum) other).getLongValue();
    return concatNumeric(runtime, (int) c);
  }
  
  if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String");
  return append19(other);
}
origin: org.jruby/jruby-core

/** rb_str_concat
 *
 */
@JRubyMethod(name = "<<")
public RubyString concatSingle(ThreadContext context, IRubyObject other) {
  Ruby runtime = context.runtime;
  if (other instanceof RubyFixnum) {
    long c = RubyNumeric.num2long(other);
    if (c < 0) {
      throw runtime.newRangeError(c + " out of char range");
    }
    return concatNumeric(runtime, (int)(c & 0xFFFFFFFF));
  } else if (other instanceof RubyBignum) {
    if (((RubyBignum) other).getBigIntegerValue().signum() < 0) {
      throw runtime.newRangeError("negative string size (or size too big)");
    }
    long c = ((RubyBignum) other).getLongValue();
    return concatNumeric(runtime, (int) c);
  }
  if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String");
  return append19(other);
}
org.jrubyRubyBignumgetBigIntegerValue

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,
  • fix2big

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JCheckBox (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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