本文整理了Java中org.jruby.Ruby.newMathDomainError
方法的一些代码示例,展示了Ruby.newMathDomainError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newMathDomainError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newMathDomainError
暂无
代码示例来源:origin: org.jruby/jruby-core
private static void domainCheck19(IRubyObject recv, double value, String msg) {
if (Double.isNaN(value)) {
throw recv.getRuntime().newMathDomainError(msg);
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static void domainCheck19(IRubyObject recv, double value, String msg) {
if (Double.isNaN(value)) {
throw recv.getRuntime().newMathDomainError(msg);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static RubyFloat log_common19(IRubyObject recv, double value, double base, String msg) {
if (value < 0) {
throw recv.getRuntime().newMathDomainError(msg);
}
double result = Math.log(value)/Math.log(base);
return RubyFloat.newFloat(recv.getRuntime(),result);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "acos", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat acos(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < -1.0 || value > 1.0) throw context.runtime.newMathDomainError("acos");
return RubyFloat.newFloat(context.runtime, Math.acos(value));
}
代码示例来源:origin: org.jruby/jruby-core
/** Returns the base 10 logarithm of x.
*
*/
@JRubyMethod(name = "log10", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat log10(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < 0) {
throw context.runtime.newMathDomainError("log10");
}
return RubyFloat.newFloat(context.runtime, Math.log10(value));
}
代码示例来源:origin: org.jruby/jruby-complete
/** Returns the base 10 logarithm of x.
*
*/
@JRubyMethod(name = "log10", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat log10(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < 0) {
throw context.runtime.newMathDomainError("log10");
}
return RubyFloat.newFloat(context.runtime, Math.log10(value));
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "sqrt", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat sqrt(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < 0) throw context.runtime.newMathDomainError("sqrt");
return RubyFloat.newFloat(context.runtime, value == 0.0 ? 0.0 : Math.sqrt(value));
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "sqrt", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat sqrt(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < 0) throw context.runtime.newMathDomainError("sqrt");
return RubyFloat.newFloat(context.runtime, value == 0.0 ? 0.0 : Math.sqrt(value));
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "asin", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat asin(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < -1.0 || value > 1.0) throw context.runtime.newMathDomainError("asin");
return RubyFloat.newFloat(context.runtime, Math.asin(value));
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "acos", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat acos(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < -1.0 || value > 1.0) throw context.runtime.newMathDomainError("acos");
return RubyFloat.newFloat(context.runtime, Math.acos(value));
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "asin", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat asin(ThreadContext context, IRubyObject recv, IRubyObject x) {
double value = RubyNumeric.num2dbl(context, x);
if (value < -1.0 || value > 1.0) throw context.runtime.newMathDomainError("asin");
return RubyFloat.newFloat(context.runtime, Math.asin(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");
}
long n = value;
long sq = floorSqrt(n);
return RubyFixnum.newFixnum(runtime, sq);
}
代码示例来源: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");
}
long n = value;
long sq = floorSqrt(n);
return RubyFixnum.newFixnum(runtime, sq);
}
代码示例来源: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 = "acos", required = 1, module = true, visibility = Visibility.PRIVATE, compat = CompatVersion.RUBY1_9)
public static RubyFloat acos19(IRubyObject recv, IRubyObject x) {
double value = needFloat(x).getDoubleValue();
if (value < -1.0 || value > 1.0) {
throw recv.getRuntime().newMathDomainError("acos");
}
double result = Math.acos(value);
return RubyFloat.newFloat(recv.getRuntime(), result);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "acos", required = 1, module = true, visibility = Visibility.PRIVATE, compat = CompatVersion.RUBY1_9)
public static RubyFloat acos19(IRubyObject recv, IRubyObject x) {
double value = needFloat(x).getDoubleValue();
if (value < -1.0 || value > 1.0) {
throw recv.getRuntime().newMathDomainError("acos");
}
double result = Math.acos(value);
return RubyFloat.newFloat(recv.getRuntime(), result);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "atanh", required = 1, module = true, visibility = Visibility.PRIVATE, compat = CompatVersion.RUBY1_9)
public static RubyFloat atanh_19(IRubyObject recv, IRubyObject x) {
double value = needFloat(x).getDoubleValue();
double y = Math.abs(value);
if (value < -1.0 || value > 1.0) {
throw recv.getRuntime().newMathDomainError("atanh");
}
double result = atanh_common(recv, x);
return RubyFloat.newFloat(recv.getRuntime(), result);
}
代码示例来源:origin: org.jruby/jruby-complete
private RubyBigDecimal newPowOfInfinity(ThreadContext context, RubyNumeric exp) {
if (Numeric.f_negative_p(context, exp)) {
if (infinitySign >= 0) return newZero(context.runtime, 0);
// (-Infinity) ** (-even_integer) -> +0 AND (-Infinity) ** (-odd_integer) -> -0
if (Numeric.f_integer_p(context, exp)) return newZero(context.runtime, isEven(exp) ? 1 : -1);
return newZero(context.runtime, -1); // (-Infinity) ** (-non_integer) -> -0
}
if (infinitySign >= 0) return newInfinity(context.runtime, 1);
if (Numeric.f_integer_p(context, exp)) return newInfinity(context.runtime, isEven(exp) ? 1 : -1);
throw context.runtime.newMathDomainError("a non-integral exponent for a negative base");
}
代码示例来源:origin: org.jruby/jruby-core
private RubyBigDecimal newPowOfInfinity(ThreadContext context, RubyNumeric exp) {
if (Numeric.f_negative_p(context, exp)) {
if (infinitySign >= 0) return newZero(context.runtime, 0);
// (-Infinity) ** (-even_integer) -> +0 AND (-Infinity) ** (-odd_integer) -> -0
if (Numeric.f_integer_p(context, exp)) return newZero(context.runtime, isEven(exp) ? 1 : -1);
return newZero(context.runtime, -1); // (-Infinity) ** (-non_integer) -> -0
}
if (infinitySign >= 0) return newInfinity(context.runtime, 1);
if (Numeric.f_integer_p(context, exp)) return newInfinity(context.runtime, isEven(exp) ? 1 : -1);
throw context.runtime.newMathDomainError("a non-integral exponent for a negative base");
}
内容来源于网络,如有侵权,请联系作者删除!