Skip to content

Error when raising to a BigDecimal  #1967

@benwoody

Description

@benwoody

When raising a FixNum to a BigDecimal, the operation errors claiming it expects a FixNum.

Repro:

Tested using jruby 1.7.15 (1.9.3p392)

require 'bigdecimal/math'
a = BigDecimal(1.2, 2)
2 ** a

Output:

TypeError: wrong argument type BigDecimal (expected Fixnum)
    from org/jruby/ext/bigdecimal/RubyBigDecimal.java:851:in `**'
    from org/jruby/RubyFixnum.java:723:in `**'
    from (irb):9:in `evaluate'
    from org/jruby/RubyKernel.java:1101:in `eval'
    from org/jruby/RubyKernel.java:1501:in `loop'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from org/jruby/RubyKernel.java:1264:in `catch'

Expectations:

In MRI, this seems to be handled correctly, regardless of the type being raised. I would expect a BigDecimal to be returned from the equation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions