help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH] Fix some bugs...


From: Paolo Bonzini
Subject: [Help-smalltalk] [PATCH] Fix some bugs...
Date: Fri, 25 May 2007 19:42:20 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

... that were uncovered by conversion.

Paolo
2007-05-25  Paolo Bonzini  <address@hidden>

        * kernel/Behavior.st: Support nil superclass more thoroughly.
        * kernel/Builtins.st: Move #instanceVariableNames: to
        ClassDescription.
        * kernel/Float.st: Print exponent for 1.0e/1.0q.  The zillionth
        printing bug.
        * kernel/ScaledDec.st: Remove initial space.

* modified files

--- orig/kernel/Behavior.st
+++ mod/kernel/Behavior.st
@@ -1218,7 +1218,10 @@ updateInstanceVars: variableArray
     | instVarMap startOfInstanceVars endOfInstanceVars newInstanceVars 
        oldInstVars oldClass instances |
 
-    startOfInstanceVars := self superclass instSize + 1.
+    startOfInstanceVars := self superclass isNil
+       ifTrue: [ 1 ]
+       ifFalse: [ self superclass instSize + 1 ].
+
     endOfInstanceVars := self instSize.
     newInstanceVars := variableArray
        copyFrom: startOfInstanceVars 


--- orig/kernel/Builtins.st
+++ mod/kernel/Builtins.st
@@ -173,10 +173,12 @@ Class extend [
     ]
 ]
     
-Behavior extend [
+ClassDescription extend [
     instanceVariableNames: ivn [
     ]
+]
     
+Behavior extend [
     shape: aSymbol [
     ]
 ]


--- orig/kernel/Float.st
+++ mod/kernel/Float.st
@@ -383,10 +383,19 @@ printOn: aStream
 
 storeOn: aStream
     "Print a representation of the receiver on aStream"
-    self
-       printOn: aStream
-       special: #('%1 infinity' '%1 negativeInfinity' '%1 nan')
-! !
+    | printString |
+    (self isInfinite or: [ self isNaN ])
+       ifTrue: [
+            ^self
+                 printOn: aStream
+                 special: #('%1 infinity' '%1 negativeInfinity' '%1 nan') ].
+    printString := self printString.
+    aStream nextPutAll: printString.
+
+    "For FloatE/FloatQ, force printing the exponent at the end."
+    self exponentLetter == $d ifTrue: [ ^self ].
+    (printString includes: self exponentLetter)
+       ifFalse: [ aStream nextPut: self exponentLetter ]! !
 
 
 
@@ -441,11 +450,12 @@ printOn: aStream special: whatToPrintArr
        prevWeight := weight.
        weight := weight / 10 ].
 
-    "Smallest number such that me + eps ~= eps"
-    eps := 2 raisedToInteger: me exponent - me class precision + 1.
-    "For large numbers, don't let round-to-even bite us."
-    eps isInteger ifTrue: [ eps := eps / 2 ].
-    (num - prevWeight quo: eps) = 0 ifTrue: [ digits := digits + 1 ].
+    num = 0 ifFalse: [
+        "Smallest number such that me + eps ~= eps"
+        eps := 2 raisedToInteger: me exponent - me class precision + 1.
+        "For large numbers, don't let round-to-even bite us."
+        eps isInteger ifTrue: [ eps := eps / 2 ].
+        (num - prevWeight quo: eps) = 0 ifTrue: [ digits := digits + 1 ] ].
 
     digits := digits printString.
 



--- orig/kernel/ScaledDec.st
+++ mod/kernel/ScaledDec.st
@@ -1,4 +1,4 @@
- "======================================================================
+"======================================================================
 |
 |   ScaledDecimal Method Definitions
 |




reply via email to

[Prev in Thread] Current Thread [Next in Thread]