#REFACTORING by exept
class: PrintfScanf class
changed: #absScientificPrintFloat:on:digits:
--- a/PrintfScanf.st Wed Nov 27 11:16:07 2019 +0100
+++ b/PrintfScanf.st Wed Nov 27 11:16:57 2019 +0100
@@ -967,13 +967,12 @@
absVal := aFloat abs.
"x is myself normalized to [1.0, 10.0), exp is my exponent"
- exp := absVal < 1.0
- ifTrue:[
- (10.0 / absVal) log10 floor asInteger negated]
- ifFalse:[
- absVal log10 floor asInteger].
-
- x := exp == 0 ifTrue:[absVal] ifFalse:[absVal / (10.0 raisedTo:exp)].
+ absVal < 1.0 ifTrue:[
+ exp := (10.0 / absVal) log10 floor asInteger negated
+ ] ifFalse:[
+ exp := absVal log10 floor asInteger
+ ].
+ exp == 0 ifTrue:[x := absVal] ifFalse:[x := absVal / (10.0 raisedTo:exp)].
"round the last digit to be printed"
fuzz := 10.0 raisedTo:1 - digits.
fuzz = 0 ifTrue:[