https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-07-19T09:55:02ZRuby Issue Tracking SystemRuby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=658442017-07-19T09:55:02Zlionel_perrin (Lionel PERRIN)lionel.perrin@gmail.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/65844/diff?detail_id=45667">diff</a>)</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=658452017-07-19T10:12:07Zlionel_perrin (Lionel PERRIN)lionel.perrin@gmail.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/65845/diff?detail_id=45668">diff</a>)</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=658462017-07-19T10:12:21Zlionel_perrin (Lionel PERRIN)lionel.perrin@gmail.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/65846/diff?detail_id=45669">diff</a>)</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=658472017-07-19T10:13:19Zlionel_perrin (Lionel PERRIN)lionel.perrin@gmail.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/65847/diff?detail_id=45670">diff</a>)</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=663392017-08-30T08:54:32Zmrkn (Kenta Murata)muraken@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>mrkn (Kenta Murata)</i></li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=686182017-12-23T23:20:12Zmrkn (Kenta Murata)muraken@gmail.com
<ul><li><strong>Target version</strong> set to <i>2.6</i></li></ul><p><a href="https://github.com/ruby/bigdecimal/issues/94" class="external">https://github.com/ruby/bigdecimal/issues/94</a></p> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=689322017-12-25T18:15:14Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.6</i></del>)</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=721902018-05-20T21:16:40Zkaratedog (Földes László)foldes.laszlo2@gmail.com
<ul></ul><p>That is the same problem as here: <a href="https://bugs.ruby-lang.org/issues/8826" class="external">https://bugs.ruby-lang.org/issues/8826</a><br>
#/ is the same method as #quo (according to documentation both methods are defined in 'bigdecimal.c' at line 1281). Currently you can divide a bigdecimal by using #/, #quo and #div but I don't really understand the design behind these methods (on a "which should do what" level).</p>
<p>#div accepts a precision argument, while #quo does not. Without precision argument #div returns Fixnum even if its first argument is a Float, it even returns Fixnum if both divisor and dividend are Float..<br>
Thus far I don't know any method that could be able to calculate a division AND set the proper precision on the result. What you can do is to manually set precision by using #div. If you set the precision to the same amount as the divisor, you will not miss any significant digits, the drawback is that you will see a lot of digit repetition for most of the numbers.</p>
<p>(1019 is a long prime, its reciprocal has 1018 significant digits)</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="o">></span> <span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">div</span><span class="p">(</span><span class="mi">1019</span><span class="p">,</span><span class="mi">1019</span><span class="p">).</span><span class="nf">to_s</span>
</code></pre> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=875332020-09-11T18:39:46Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-8 priority-4 priority-default closed" href="/issues/8826">Bug #8826</a>: BigDecimal#div and #quo different behavior and inconsistencies</i> added</li></ul> Ruby master - Bug #13754: bigdecimal with lower precision that Floathttps://bugs.ruby-lang.org/issues/13754?journal_id=954392021-12-20T12:35:46Zmrkn (Kenta Murata)muraken@gmail.com
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Third Party's Issue</i></li></ul><p>This was fixed at <a href="https://github.com/ruby/bigdecimal/issues/94" class="external">https://github.com/ruby/bigdecimal/issues/94</a>.</p>