congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
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

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • putExtra (Intent)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JLabel (javax.swing)
  • Top 25 Plugins for Webstorm
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