Codota Logo
RubyBignum.bignorm
Code IndexAdd Codota to your IDE (free)

How to use
bignorm
method
in
org.jruby.RubyBignum

Best Java code snippets using org.jruby.RubyBignum.bignorm (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

/** rb_big_uminus
 *
 */
@Override
public IRubyObject op_uminus(ThreadContext context) {
  return bignorm(context.runtime, value.negate());
}
origin: org.jruby/jruby-complete

@Override
public RubyInteger op_rshift(ThreadContext context, long shift) {
  return bignorm(context.runtime, value.shiftRight((int) shift));
}
origin: org.jruby/jruby-complete

public IRubyObject decode(Ruby runtime, ByteBuffer enc) {
  long l = decodeLongBigEndian(enc);
  return RubyBignum.bignorm(runtime,BigInteger.valueOf(l).and(new BigInteger("FFFFFFFFFFFFFFFF", 16)));
}
origin: org.jruby/jruby-complete

@Override
public final IRubyObject op_plus(ThreadContext context, long other) {
  BigInteger result = value.add(BigInteger.valueOf(other));
  if (other > 0 && value.signum() > 0) return new RubyBignum(context.runtime, result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-complete

@Override
public final IRubyObject op_minus(ThreadContext context, long other) {
  BigInteger result = value.subtract(BigInteger.valueOf(other));
  if (value.signum() < 0 && other > 0) return new RubyBignum(context.runtime, result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-core

public final IRubyObject op_plus(ThreadContext context, BigInteger other) {
  BigInteger result = value.add(other);
  if (value.signum() > 0 && other.signum() > 0) return new RubyBignum(context.runtime, result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-complete

public final IRubyObject op_minus(ThreadContext context, BigInteger other) {
  BigInteger result = value.subtract(other);
  if (value.signum() < 0 && other.signum() > 0) return new RubyBignum(context.runtime, result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-complete

public final IRubyObject op_plus(ThreadContext context, BigInteger other) {
  BigInteger result = value.add(other);
  if (value.signum() > 0 && other.signum() > 0) return new RubyBignum(context.runtime, result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-complete

private RubyInteger divideImpl(Ruby runtime, BigInteger otherValue) {
  if (otherValue.signum() == 0) throw runtime.newZeroDivisionError();
  final BigInteger result;
  if (value.signum() * otherValue.signum() == -1) {
    BigInteger[] results = value.divideAndRemainder(otherValue);
    result = results[1].signum() != 0 ? results[0].subtract(BigInteger.ONE) : results[0];
  } else {
    result = value.divide(otherValue);
  }
  return bignorm(runtime, result);
}
origin: org.jruby/jruby-core

/**
 * Return a Bignum or Fixnum (Integer) for the given value, or raise FloatDomainError if it is out of range.
 *
 * MRI: rb_dbl2big
 */
public static RubyInteger newBignorm(Ruby runtime, double value) {
  try {
    return bignorm(runtime, toBigInteger(value));
  } catch (NumberFormatException nfe) {
    throw runtime.newFloatDomainError(Double.toString(value));
  }
}
origin: org.jruby/jruby-complete

/**
 * Return a Bignum or Fixnum (Integer) for the given value, or raise FloatDomainError if it is out of range.
 *
 * MRI: rb_dbl2big
 */
public static RubyInteger newBignorm(Ruby runtime, double value) {
  try {
    return bignorm(runtime, toBigInteger(value));
  } catch (NumberFormatException nfe) {
    throw runtime.newFloatDomainError(Double.toString(value));
  }
}
origin: org.jruby/jruby-complete

@Override
public IRubyObject op_mod(ThreadContext context, long other) {
  if (other == 0) throw context.runtime.newZeroDivisionError();
  BigInteger result = value.mod(long2big(other < 0 ? -other : other));
  if (other < 0 && result.signum() != 0) result = long2big(other).add(result);
  return bignorm(context.runtime, result);
}
origin: org.jruby/jruby-core

@Override
public IRubyObject op_mod(ThreadContext context, long other) {
  if (other == 0) throw context.runtime.newZeroDivisionError();
  BigInteger result = value.mod(long2big(other < 0 ? -other : other));
  if (other < 0 && result.signum() != 0) result = long2big(other).add(result);
  return bignorm(context.runtime, result);
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private IRubyObject addFixnum(long other) {
  BigInteger result = value.add(BigInteger.valueOf(other));
  if (other > 0 && value.signum() > 0) return new RubyBignum(getRuntime(), result);
  return bignorm(getRuntime(), result);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

private IRubyObject addFixnum(long other) {
  BigInteger result = value.add(BigInteger.valueOf(other));
  if (other > 0 && value.signum() > 0) return new RubyBignum(getRuntime(), result);
  return bignorm(getRuntime(), result);
}
origin: org.jruby/jruby-complete

final RubyInteger to_int(Ruby runtime) {
  checkFloatDomain();
  try {
    return RubyFixnum.newFixnum(runtime, value.longValueExact());
  } catch (ArithmeticException ex) {
    return RubyBignum.bignorm(runtime, value.toBigInteger());
  }
}
origin: org.jruby/jruby-complete

/** rb_big_and
 *
 */
@Override
public IRubyObject op_and(ThreadContext context, IRubyObject other) {
  if (other instanceof RubyBignum) {
    return bignorm(context.runtime, value.and(((RubyBignum) other).value));
  }
  if (other instanceof RubyFixnum) {
    return op_and(context, (RubyFixnum) other);
  }
  return coerceBit(context, sites(context).checked_op_and, other);
}
origin: org.jruby/jruby-core

@Override
public IRubyObject sqrt(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (isNegative()) {
    throw runtime.newMathDomainError("Numerical argument is out of domain - isqrt");
  }
  return bignorm(runtime, floorSqrt(value));
}
origin: org.jruby/jruby-complete

@Override
public IRubyObject sqrt(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (isNegative()) {
    throw runtime.newMathDomainError("Numerical argument is out of domain - isqrt");
  }
  return bignorm(runtime, floorSqrt(value));
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"to_i", "to_int"}, compat = CompatVersion.RUBY1_8)
public IRubyObject to_int() {
  if (isNaN() || infinitySign != 0) {
    return getRuntime().getNil();
  }
  try {
    return RubyNumeric.int2fix(getRuntime(), value.longValueExact());
  } catch (ArithmeticException ae) {
    return RubyBignum.bignorm(getRuntime(), value.toBigInteger());            
  }
}
org.jrubyRubyBignumbignorm

Javadoc

rb_big_norm

Popular methods of RubyBignum

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • String (java.lang)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Hashtable (java.util)
    Hashtable is a synchronized implementation of Map. All optional operations are supported.Neither key
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
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