Re: 1e-4 printing bug

Derek Zhou <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>
All,

The previous patch contains a bug. Please use this one:

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
allNines.patch (text/x-diff, 903 B)
diff --git a/kernel/Float.st b/kernel/Float.st
index 3714f08..c594ba6 100644
--- a/kernel/Float.st
+++ b/kernel/Float.st
@@ -527,10 +527,11 @@ if the hardware supports it.'>
 	allNines := true.
         sameDown := true.
         sameUp := true.
+	digit := 9.
 
-        [digit := num // weight.
+        [allNines := allNines and: [digit = 9].
+	digit := num // weight.
         num := num \\ weight.
-	allNines := allNines and: [digit = 9].
         sameDown := sameDown and: [num >= eps].
         sameUp := sameUp and: [num < (weight - eps)].
 	digits := digits * 10 + digit.
@@ -555,7 +556,7 @@ if the hardware supports it.'>
             (num - prevWeight) abs < num ifTrue: [adjust := 1]].
 
 	digits := digits + adjust.
-	(adjust > 0 and: [allNines])
+	(adjust = (10 - digit) and: [allNines])
             ifTrue: [allNines := false. exponent := exponent + 1].
 
 	digits := digits printString.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.