<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 7:22 PM, Chuck Hipschman <span dir="ltr">&lt;<a href="mailto:ckhipschman@gmail.com" target="_blank">ckhipschman@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">7 / 8.0 roundTo 0.01 = 0.88  Aha! Thanks!<div><br></div><div>But:</div><div><br></div><div>100 * (1.05 raisedTo: 10) roundTo: 0.01 162.89000000000001 </div><div>                                                              &quot;162.88946267774418&quot; &quot;unrounded&quot;</div><div>100 * (1.05 raisedTo: 15) roundTo: 0.01 207.89000000000001</div><div>                                                               &quot;207.8928179411367&quot;  &quot;unrounded&quot;</div><div> Bug, or me again :-)</div><div><br></div></div></blockquote><div> </div><div>If you debug into #roundTo: you&#39;ll see its implementation is simple arithmetic, subject to the vagaries of float resolution.</div><div><br></div><div>Float(Number)&gt;&gt;roundTo:</div><div>    ^(self / quantum) rounded * quantum<br></div><div><br></div><div>Now are you wanting something nicely formatted for display, or are you rounding for some mathematic purpose?  Perhaps instead you are wanting...</div><div><br></div><div>   100 * (1.05 raisedTo: 10) printShowingDecimalPlaces: 2  &quot; --&gt; 162.89 &quot;</div><div><br></div><div>   0.105 printShowingDecimalPlaces: 2    &quot; --&gt; 0.10 &quot;<br></div><div><br></div><div>   0.115 printShowingDecimalPlaces: 2    &quot; --&gt; 0.12 &quot;<br></div><div><br></div><div>btw, I only found these today, looking in the printing protocol of Number and Float.</div><div><br></div><div>cheers -ben</div></div></div></div>