equal
deleted
inserted
replaced
965 ]. |
965 ]. |
966 |
966 |
967 absVal := aFloat abs. |
967 absVal := aFloat abs. |
968 |
968 |
969 "x is myself normalized to [1.0, 10.0), exp is my exponent" |
969 "x is myself normalized to [1.0, 10.0), exp is my exponent" |
970 exp := absVal < 1.0 |
970 absVal < 1.0 ifTrue:[ |
971 ifTrue:[ |
971 exp := (10.0 / absVal) log10 floor asInteger negated |
972 (10.0 / absVal) log10 floor asInteger negated] |
972 ] ifFalse:[ |
973 ifFalse:[ |
973 exp := absVal log10 floor asInteger |
974 absVal log10 floor asInteger]. |
974 ]. |
975 |
975 exp == 0 ifTrue:[x := absVal] ifFalse:[x := absVal / (10.0 raisedTo:exp)]. |
976 x := exp == 0 ifTrue:[absVal] ifFalse:[absVal / (10.0 raisedTo:exp)]. |
|
977 "round the last digit to be printed" |
976 "round the last digit to be printed" |
978 fuzz := 10.0 raisedTo:1 - digits. |
977 fuzz := 10.0 raisedTo:1 - digits. |
979 fuzz = 0 ifTrue:[ |
978 fuzz = 0 ifTrue:[ |
980 fuzz := 10.0 asLongFloat raisedTo:1 - digits. |
979 fuzz := 10.0 asLongFloat raisedTo:1 - digits. |
981 fuzz = 0 ifTrue:[ |
980 fuzz = 0 ifTrue:[ |