https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112013-01-23T17:48:20ZRuby Issue Tracking SystemRuby master - Bug #7724: 6 bugs with Range#bsearch over floatshttps://redmine.ruby-lang.org/issues/7724?journal_id=355442013-01-23T17:48:20Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>mame (Yusuke Endoh)</i></li></ul> Ruby master - Bug #7724: 6 bugs with Range#bsearch over floatshttps://redmine.ruby-lang.org/issues/7724?journal_id=355462013-01-23T18:42:15Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Assignee</strong> changed from <i>mame (Yusuke Endoh)</i> to <i>marcandre (Marc-Andre Lafortune)</i></li></ul><p>Thanks Marc-Andre!</p>
<p>But I'm very sorry that I'll have no enough time to pursue this issues.<br>
Could you please create a patch for C implementation?</p>
<p>Notice that the current implementation does NOT assume that the internal<br>
representation of double is IEEE 754. Please do not depend on it but<br>
use C's constants about double, such as FLT_RADIX and DBL_MANT_DIG.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Bug #7724: 6 bugs with Range#bsearch over floatshttps://redmine.ruby-lang.org/issues/7724?journal_id=355632013-01-24T04:38:53Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>mame (Yusuke Endoh) wrote:</p>
<blockquote>
<p>Thanks Marc-Andre!</p>
<p>But I'm very sorry that I'll have no enough time to pursue this issues.<br>
Could you please create a patch for C implementation?</p>
</blockquote>
<p>Sure, I'll do it.</p>
<blockquote>
<p>Notice that the current implementation does NOT assume that the internal<br>
representation of double is IEEE 754. Please do not depend on it but<br>
use C's constants about double, such as FLT_RADIX and DBL_MANT_DIG.</p>
</blockquote>
<p>Actually, I don't think there is need to know how many bits are used for the mantissa vs exponent; I only need to know that double is represented with exponent bits then by mantissa bits. Apart from VAX (which had strange byte ordering, but we don't support), I believe this to be true.</p>
<p>So floatings can be seen as [exp, mantissa], thus have the same ordering as the the corresponding integers (forgetting about the sign). I.e. (double)(++(int64_t)a_float) is the smallest float strictly greater than a_float (assuming 0 <= a_float < infinity)</p>
<p>Do we have a list of non IEEE architectures we're hoping to support? Are there systems where sizeof(double) != sizeof(int_64_t)?</p> Ruby master - Bug #7724: 6 bugs with Range#bsearch over floatshttps://redmine.ruby-lang.org/issues/7724?journal_id=357082013-01-30T07:00:50Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r38978.<br>
Marc-Andre, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>range.c: Fix Range#bsearch for floats [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: 6 bugs with Range#bsearch over floats (Closed)" href="https://redmine.ruby-lang.org/issues/7724">#7724</a>]</li>
</ul>