Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/org/jruby/RubyMath.java
Original file line number Diff line number Diff line change
@@ -357,7 +357,13 @@ public static RubyFloat log10(ThreadContext context, IRubyObject recv, IRubyObje

@JRubyMethod(name = "log10", required = 1, module = true, visibility = Visibility.PRIVATE)
public static RubyFloat log10_19(ThreadContext context, IRubyObject recv, IRubyObject x) {
return log_common19(recv, RubyNumeric.num2dbl(x), 10, "log10");
double value = RubyNumeric.num2dbl(x);

if (value < 0) {
throw context.runtime.newMathDomainError("log10");
}

return RubyFloat.newFloat(context.runtime, Math.log10(value));
}

/** Returns the base 2 logarithm of x.

0 comments on commit 69b5767

Please sign in to comment.