Reputation: 1395
Im currently getting this result for multiplication
(0.01317818 * 0.00014300)
=> 1.88447974e-06
How can I make the returned result
(0.01317818 * 0.00014300)
=> 0.00000188
Across the whole system
Upvotes: 0
Views: 351
Reputation: 622
To get 8 decimal places:
"%.8f" % (0.01317818 * 0.00014300)
=> 0.00000188
A bit simpler than using big decimal.
Upvotes: 1
Reputation: 10624
You can use bigdecimal
. It is a gem
.
require 'bigdecimal'
a = BigDecimal.new('0.01317818')
b = BigDecimal.new('0.00014300')
c = a * b
Upvotes: 1