I was noticing a weird issue in ruby where I had a division statement that was returning an integer when it should have returned a decimal value. Check this out.
number = 0.1 + BigDecimal('0.2') # Note the value passed to BigDecimal is a string, this is important to maintain accuracy
number.to_s('F') #=> 0.3 '# F' specifies using floating point notation instead of engineering
Related External Links: