Alternative coding for decimal arithmetic

Can’t you just do something like
(1/ (trate.to_f)).to_s
I expect you don’t need all the parantheses1

Colin Law wrote:

Can't you just do something like
(1/ (trate.to_f)).to_s
I expect you don't need all the parantheses1

I cannot drop to floating point. It has to be integer arithmetic.

Marnen Laibow-Koser wrote:

Use BigDecimal (part of the standard library). It does
arbitrary-precision decimal arithmetic without the problems of floats.
I think the syntax would be something like

Thanks, that works much better.