<div dir="ltr"><div><span style="line-height:1.5;font-size:13.1999998092651px">Racket:</span></div><span style="line-height:1.5;font-size:13.1999998092651px">(+ .1 .1 .1 .1 .1 .1 .1 .1)</span><div>0.7999999999999999</div><div><br></div><div>Python:</div><div>







<p><span>>>> .1 + .1 + .1 + .1 + .1 + .1 + .1 + .1</span></p>
<p><span>0.7999999999999999</span></p><p>Looks consistent to me =)</p></div><div dir="ltr"><br><div class="gmail_quote">On Tue Feb 24 2015 at 10:43:19 AM Laurent <<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I've discovered a rather troubling behaviour when using `in-range` with floating point numbers, which I think is worth knowing in case you hadn't consider the issue before:<br></div><div><br></div><div>On my machine, I get the following:</div><div><div><br></div><div>(length (for/list ([i (in-range .1 .7 .1)]) i)) ; 6</div><div>(length (for/list ([i (in-range .1 .8 .1)]) i)) ; 8 (!)</div></div><div><br></div><div>But:</div><div><div>(length (for/list ([i (in-range 1/10 7/10 1/10)]) i)) ; 6</div><div>(length (for/list ([i (in-range 1/10 8/10 1/10)]) i)) ; 7</div></div><div><br></div><div><br></div><div>Would it be a good idea to safe-guard these kinds of cases directly in `in-range`?</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>u<u></u><u></u>sers</a><br>
</blockquote></div></div></div>