storeOn fixed for negative numbers with 0 scale
authorClaus Gittinger <cg@exept.de>
Fri, 17 Feb 2006 14:15:58 +0100
changeset 9133 2d3e3d083be8
parent 9132 df7fe5738d18
child 9134 98d5bfd1cc51
storeOn fixed for negative numbers with 0 scale
FixedPoint.st
--- a/FixedPoint.st	Fri Feb 17 14:12:28 2006 +0100
+++ b/FixedPoint.st	Fri Feb 17 14:15:58 2006 +0100
@@ -922,7 +922,7 @@
      For printout, only scale post-decimal digits are printed
      (and the printout is rounded to that many digits)"
 
-    |e integerPart fractionPart negative num|
+    |e integerPart fractionPart negative num rest|
 
     numerator < 0 ifTrue:[
         negative := true.
@@ -968,8 +968,11 @@
             ((fractionPart printStringPaddedTo:scale with:$0) copyFrom:2) printOn:aStream
         ].
     ] ifFalse:[
-        aStream nextPut: $..
-        ((fractionPart printString) copyFrom:2) printOn:aStream
+        rest := ((fractionPart printString) copyFrom:2).
+        rest notEmpty ifTrue:[
+            aStream nextPut: $..
+            rest printOn:aStream
+        ]
     ].
 
     "
@@ -1236,5 +1239,5 @@
 !FixedPoint class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FixedPoint.st,v 1.33 2006-02-17 13:12:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FixedPoint.st,v 1.34 2006-02-17 13:15:58 cg Exp $'
 ! !