Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix BigDecimal.new starting with underscores

  • Loading branch information...
commit 403f943bb494b7bf1e29f8921ced304ca6ae1f22 1 parent b40a551
@calavera calavera authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/org/jruby/RubyBigDecimal.java
View
5 src/org/jruby/RubyBigDecimal.java
@@ -383,7 +383,10 @@ public static RubyBigDecimal newInstance(IRubyObject recv, IRubyObject[] args) {
// by Java's BigDecimal. Not terribly efficient for now.
// 1. MRI allows d and D as exponent separators
strValue = strValue.replaceFirst("[dD]", "E");
- // 2. MRI allows underscores anywhere
+ // 2. MRI allows underscores anywhere but in the beginning
+ if (strValue.startsWith("_")) {
+ return newZero(runtime, 1);
+ }
strValue = strValue.replaceAll("_", "");
// 3. MRI ignores the trailing junk
strValue = NUMBER_PATTERN.matcher(strValue).replaceFirst("$1");
Please sign in to comment.
Something went wrong with that request. Please try again.