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

How to use
even_p
method
in
org.jruby.RubyBignum

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

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);
}
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: org.jruby/jruby-core

private IRubyObject powerOther(ThreadContext context, IRubyObject other) {
  final Ruby runtime = context.runtime;
  final long a = this.value;
  if (other instanceof RubyBignum) {
    if (sites(context).op_lt_bignum.call(context, other, other, RubyFixnum.zero(runtime)).isTrue()) {
      RubyRational rational = RubyRational.newRationalRaw(runtime, this);
      return numFuncall(context, rational, sites(context).op_exp_rational, 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);
    }
    return RubyBignum.newBignum(runtime, RubyBignum.long2big(a)).op_pow(context, other);
  }
  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, sites(context).op_exp, other);
}
origin: org.jruby/jruby-complete

private IRubyObject powerOther(ThreadContext context, IRubyObject other) {
  final Ruby runtime = context.runtime;
  final long a = this.value;
  if (other instanceof RubyBignum) {
    if (sites(context).op_lt_bignum.call(context, other, other, RubyFixnum.zero(runtime)).isTrue()) {
      RubyRational rational = RubyRational.newRationalRaw(runtime, this);
      return numFuncall(context, rational, sites(context).op_exp_rational, 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);
    }
    return RubyBignum.newBignum(runtime, RubyBignum.long2big(a)).op_pow(context, other);
  }
  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, sites(context).op_exp, other);
}
org.jrubyRubyBignumeven_p

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

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Kernel (java.awt.image)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • JComboBox (javax.swing)
  • Top Vim plugins
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