<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY 
style="WORD-WRAP: break-word; webkit-nbsp-mode: space; webkit-line-break: after-white-space">
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>Ok, don't beat me.. I'm not proud of this but I have to 
use until I manage to have something better.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>String&gt;&gt;asScaledDecimal: 
aQuantityOfDigits<BR>&nbsp;"Answers the scaled decimal with aQuantityOfDigits 
<BR>&nbsp;of precision represented by the receiver."<BR>&nbsp;<BR>&nbsp;^ 
[:number|<BR>&nbsp;&nbsp;number isZero<BR>&nbsp;&nbsp;&nbsp;ifTrue:[0 asFloat 
asScaledDecimal: aQuantityOfDigits]<BR>&nbsp;&nbsp;&nbsp;ifFalse:[number 
asScaledDecimal: aQuantityOfDigits]] value: self asNumber&nbsp; 
</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>so my converter can do this depending on it's own 
configuration (not only used for money):</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>MVPNumberToText&gt;&gt;rightToLeft: 
aString<BR>&nbsp;"Answers the result of converting aString to a Number or 
aScaledDecimal."</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>&nbsp;^self 
hasInputDigits<BR>&nbsp;&nbsp;ifTrue:[aString asScaledDecimal: 
inputDigits]<BR>&nbsp;&nbsp;ifFalse:[aString asNumber]</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>Adding the horrible hack:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>ScaledDecimal&gt;&gt;printOn: aStream 
<BR>&nbsp;"Reimplementation - Object 'printing' method."<BR>&nbsp;| aFraction 
tmpFractionPart |<BR>&nbsp;self &lt; 0 ifTrue: [aStream nextPut: 
$-].<BR>&nbsp;aFraction := fraction abs.<BR>&nbsp;aStream nextPutAll: aFraction 
rounded printString.<BR>&nbsp;scale = 0 ifTrue: [^ aStream nextPutAll: 
's0'].<BR>&nbsp;aStream nextPut: $..<BR>&nbsp;tmpFractionPart := aFraction 
fractionPart.<BR>&nbsp;1 to: scale<BR>&nbsp;&nbsp;do: 
<BR>&nbsp;&nbsp;&nbsp;[:dummy | <BR>&nbsp;&nbsp;&nbsp;tmpFractionPart := 
tmpFractionPart * 10.<BR>&nbsp;&nbsp;&nbsp;(10 &lt;= tmpFractionPart 
rounded)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ifTrue:[aStream nextPut: 
$0]<BR>&nbsp;&nbsp;&nbsp;&nbsp;ifFalse:[aStream nextPut: (Character digitValue: 
tmpFractionPart rounded)].<BR>&nbsp;&nbsp;&nbsp;tmpFractionPart := 
tmpFractionPart fractionPart].</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>I was able to make the values to 
behave,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
class=046212819-22112007>&nbsp;&nbsp;&nbsp; thanks,</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV align=left><SPAN class=250542422-20122006>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt" align=left><?xml:namespace prefix 
= st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:PersonName 
ProductID="Sebastian Sastre&#13;" w:st="on"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'">Sebastian 
Sastre<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" 
/><o:p></o:p></SPAN></st1:PersonName></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'"><o:p>&nbsp;</o:p></SPAN></SPAN><BR></P></DIV>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=es dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>De:</B> 
  squeak-dev-bounces@lists.squeakfoundation.org 
  [mailto:squeak-dev-bounces@lists.squeakfoundation.org] <B>En nombre de </B>tim 
  Rowledge<BR><B>Enviado el:</B> Jueves, 22 de Noviembre de 2007 
  17:10<BR><B>Para:</B> The general-purpose Squeak developers 
  list<BR><B>Asunto:</B> Re: 5.3 printShowingDecimalPlaces: 2 displays '5.29' 
  insteadof'5.30'<BR></FONT><BR></DIV>
  <DIV></DIV><BR>
  <DIV>
  <DIV>On 22-Nov-07, at 11:00 AM, Sebastian Sastre wrote:</DIV><BR 
  class=Apple-interchange-newline>
  <BLOCKQUOTE type="cite">
    <DIV 
    style="WORD-WRAP: break-word; webkit-nbsp-mode: space; webkit-line-break: after-white-space">
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>Thanks Tim,</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;&nbsp;&nbsp; </SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;&nbsp;&nbsp; may be I should clarify that 
    it's only for presentation. The mone value is stored as anMeasure of it's 
    monetary unit in the Aconcagua framework.</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;&nbsp;&nbsp; But I'm curious about your 
    answer. Let's supose the user enters in&nbsp;some input widget with keyboard 
    the '5.30'&nbsp;value. That will end as a Float at some point. Do you 
    suggest I convert that to a ScaledDecimal? (to store/comare, 
    etc)?</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;&nbsp;&nbsp; I'm evaluating 
    this:</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;(5.3 asScaledDecimal: 2) 
    <BR></SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face="Trebuchet MS" color=#0000ff size=2><SPAN 
    class=984495318-22112007>&nbsp;&nbsp;&nbsp; and also obtainig:&nbsp; ' 
    5.29s2'</SPAN></FONT></DIV></DIV></BLOCKQUOTE><BR></DIV>
  <DIV>That must surely count as a bug and I'd hazard a guess that it happens 
  because some code is comparing floats; I've not looked at the code but I've 
  seen it too many times not to suspect it.</DIV>
  <DIV><BR class=webkit-block-placeholder></DIV>
  <DIV>As for your input widget, I'd try to make it give you the string and 
  directly convert that to a 2dp scaled decimal rather than letting it give you 
  a float. If there isn't a String&gt;asScaledFloat: type method then I guess 
  you get to write it :-)</DIV><BR>
  <DIV apple-content-edited="true"><SPAN class=Apple-style-span 
  style="WORD-SPACING: 0px; FONT: 14px Palatino; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">
  <DIV 
  style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: after-white-space">
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>tim</DIV>
  <DIV>--</DIV>
  <DIV>tim Rowledge; tim@rowledge.org; <A 
  href="http://www.rowledge.org/tim">http://www.rowledge.org/tim</A></DIV>
  <DIV>All the simple programs have been written, and all the good names 
  taken.</DIV></DIV><BR 
class=Apple-interchange-newline></SPAN></DIV><BR></BLOCKQUOTE></BODY></HTML>