[squeak-dev] The Trunk: Kernel-nice.561.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Mar 29 20:48:31 UTC 2011
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.561.mcz
==================== Summary ====================
Name: Kernel-nice.561
Author: nice
Time: 29 March 2011, 10:48:02.38 pm
UUID: 5565b8cf-af97-b84a-98d3-d7743983f140
Ancestors: Kernel-nice.560
Oops, correct
(-1999/1000) printShowingDecimalPlaces: 2
before someone see my bugs
=============== Diff against Kernel-nice.560 ===============
Item was changed:
----- Method: Fraction>>printOn:showingDecimalPlaces: (in category 'printing') -----
printOn: aStream showingDecimalPlaces: placesDesired
"Same as super, but provides a faster implementation by inlining some Fraction protocol thus avoiding intermediate Fraction creation."
| roundedFractionPart integerPart scaling |
placesDesired <= 0
ifTrue: [self rounded printOn: aStream]
ifFalse:
[scaling := 10 raisedToInteger: placesDesired.
integerPart := numerator abs quo: denominator.
roundedFractionPart := (numerator abs - (integerPart * denominator)) * scaling * 2 + denominator quo: denominator * 2.
roundedFractionPart = scaling
ifTrue:
+ [integerPart := integerPart + 1.
- [integerPart := integerPart + numerator sign.
roundedFractionPart := 0].
numerator negative ifTrue: [aStream nextPut: $-].
integerPart printOn: aStream.
aStream nextPut: $..
roundedFractionPart printOn: aStream base: 10 length: placesDesired padded: true].!
More information about the Squeak-dev
mailing list
|