java.bigDecimal divide in ruby environment

Posted by Eyal on Stack Overflow See other posts from Stack Overflow or by Eyal
Published on 2010-05-02T22:24:40Z Indexed on 2010/05/02 22:27 UTC
Read the original article Hit count: 319

Filed under:
|
|
|

I right script in Ruby that include java classes

require 'java'
include_class 'java.math.BigDecimal'
include_class 'java.math.RoundingMode'

during the script I need to divide 2 java.bigDecimal

 one = BigDecimal.new("1")
 number1 = BigDecimal.new("3")
 number1 = one.divide(number1,RoundingMode.new(HALF_EVEN))

since I don't have intellisense in this IDE I'm not sure the syntax is right and the runtime error is:

uninitialized constant::HALF_EVEN

  1. do I combine java object in the ruby scrpit in the right way?
  2. how should I divide two java.bigDecimal object in ruby env?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about java