https://bugs.ruby-lang.org/
https://bugs.ruby-lang.org/favicon.ico?1711330511
2012-09-15T07:05:28Z
Ruby Issue Tracking System
Ruby master - Bug #7024: 90 * 1.1 => 99.00000000000001
https://bugs.ruby-lang.org/issues/7024?journal_id=29314
2012-09-15T07:05:28Z
marcandre (Marc-Andre Lafortune)
marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>This is expected from floating point calculations; you'll get this result in other languages too.</p>
<p>Checkout <a href="http://0.30000000000000004.com/" class="external">http://0.30000000000000004.com/</a></p>
Ruby master - Bug #7024: 90 * 1.1 => 99.00000000000001
https://bugs.ruby-lang.org/issues/7024?journal_id=29325
2012-09-15T21:11:29Z
alexeymuranov (Alexey Muranov)
<ul></ul><p>Julien, try</p>
<p>(90 * Rational(11, 10)).to_f</p>
<p>or</p>
<p>(90 * '1.1'.to_r).to_f</p>
<p>or</p>
<p>(90 * 1.1.rationalize).to_f</p>