I'm not sure that catch (ArithmeticException e) is the best way to fix it, but at least this would emulate MRI behaviour (read #4324 for more context)
catch (ArithmeticException e)
Fix unexpected java.lang.ArithmeticException
when converting Rational to BigDecimal
(Totally unrelated to your fix:) The appveyor CI job failed with this message: https://ci.appveyor.com/project/jnr/jruby/build/2880/job/shniu1cn7yluu99o#L1692
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=2G;
support was removed in 8.0
Error occurred during initialization of VM
Could not reserve enough space for 3145728KB object heap
Hm, perhaps MAVEN_OPTS -Xmx2G could be something?
@olleolleolle I think that the ignoring option is just a warning because it's also printed on successful test runs:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=2G; support was removed in 8.0
Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.485 sec - in
I'm more worried about other failures like uninitialized constant FFI::Platform. Perhaps we should create a separate issue to discuss ways how we can fix Appveyor.
uninitialized constant FFI::Platform
@enebo @headius you guys have any thoughts on this fix?
@kirs najs fix ... although it looks a bit scary on first sight :)
the docs on java.math.BigDecimal#divide says throws ArithmeticException - if the exact quotient does not have a terminating decimal expansion ... so this should be very decent.
@kares if you reviewed this and are happy with it you can merge it. I felt out of depth on this one.