I don&#39;t believe roundTo: is the method you&#39;re looking for. <div>I&#39;ve been confused by this before. </div><div><br></div><div><div>roundTo: quantum </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Answer the nearest number that is a multiple of quantum.&quot;</div>

<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^(self / quantum) rounded * quantum</div><div><br></div><div>Maybe try this:</div><div></div></div><div><br></div><div><div>roundedToFloat: quantum </div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Round to decimal places.&quot;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| aReciprocal |</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>aReciprocal := quantum reciprocal rounded.</div>

<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^(self * aReciprocal) rounded / aReciprocal asFloat</div><div><br></div><div><br></div><div><br></div><div class="gmail_quote">On Sun, May 6, 2012 at 9:20 PM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sun, 6 May 2012, Chris Muller wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
( 0.9580000000000001 roundTo: 0.0001) = 0.9580   &quot;false&quot;<br>
</blockquote>
<br>
Still didn&#39;t look at the code, but 0.0001 is also a Float and it doesn&#39;t have an exact representation in base 2. The following works as expected:<br>
(0.9580000000000001 roundTo: 0.0001s4) &quot;0.9580s4&quot;<br>
(0.9580000000000001 roundTo: 1/10000) &quot;(479/500)&quot;<br>
<br>
<br>
Levente<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
On Sun, May 6, 2012 at 8:55 PM, Levente Uzonyi &lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, 6 May 2012, Chris Muller wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
With the latest trunk updates, I&#39;m having trouble rounding to my<br>
desired precision:<br>
<br>
   0.9580000000000001 roundTo: 0.0001    &quot; 0.9580000000000001&quot;<br>
<br>
In Squeak 4.3 I get what I expect:<br>
<br>
   0.9580000000000001 roundTo: 0.0001   &quot; 0.958&quot;<br>
<br>
<br>
</blockquote>
<br>
I&#39;m pretty sure it&#39;s just a difference in printing. 0.958 is unlikely to<br>
have an exact base 2 representation.<br>
<br>
<br>
Levente<br>
<br>
</blockquote>
<br>
</blockquote>
<br><br>
<br></blockquote></div><br></div>