Skip to content

Instantly share code, notes, and snippets.

@shu0115
Created April 17, 2012 09:53
Show Gist options
  • Save shu0115/2404985 to your computer and use it in GitHub Desktop.
Save shu0115/2404985 to your computer and use it in GitHub Desktop.
BigDecimal/to_d - float演算
◆例
[ 0.001 * 100 ] : 0.1
[ 0.58 * 100 ] : 57.99999999999999
[ 0.58.to_d * 100 ] : #<BigDecimal:1017f2f68,'0.58E2',9(36)>
[ 0.58.class.name ] : "Float"
[ 0.58.to_d.class.name ] : "BigDecimal"
[ (0.58.to_d * 100).to_i ] : 58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment