[squeak-dev] The Trunk: System-nice.485.mcz

commits at source.squeak.org commits at source.squeak.org
Sun May 6 20:03:54 UTC 2012


Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.485.mcz

==================== Summary ====================

Name: System-nice.485
Author: nice
Time: 6 May 2012, 10:02:40.872 pm
UUID: a99f0998-cc76-4d4c-8042-8132668e7c4c
Ancestors: System-eem.484

Avoid spurious decimals in MessageTally reports.

Indeed, 

45.8 roundTo: 0.1
-> 45.800000000000004

(45.8 roundTo: 1/10) asFloat
-> 45.8

=============== Diff against System-eem.484 ===============

Item was changed:
  ----- Method: MessageTally>>printOn:total:totalTime:tallyExact: (in category 'printing') -----
  printOn: aStream total: total totalTime: totalTime tallyExact: isExact 
  	| aSelector className myTally aClass percentage |
  	isExact 
  		ifTrue: 
  			[myTally := tally.
  			receivers == nil 
  				ifFalse: [receivers do: [:r | myTally := myTally - r tally]].
  			aStream
  				print: myTally;
  				space]
  		ifFalse: 
+ 			[percentage := tally asFloat / total * 100.0.
- 			[percentage := tally asFloat / total * 100.0 roundTo: 0.1.
  			aStream
+ 				nextPutAll: (percentage printShowingDecimalPlaces: 1);
- 				print: percentage;
  				nextPutAll: '% {';
  				print: (percentage * totalTime / 100) rounded;
  				nextPutAll: 'ms} '].
  	receivers == nil 
  		ifTrue: 
  			[aStream
  				nextPutAll: 'primitives';
  				cr]
  		ifFalse: 
  			[aSelector := method selector.
  			aClass := method methodClass.
  			className := aClass name contractTo: self maxClassNameSize.
  			aStream
  				nextPutAll: class name;
  				nextPutAll: (aClass = class 
  							ifTrue: ['>>']
  							ifFalse: ['(' , aClass name , ')>>']);
  				nextPutAll: (aSelector 
  							contractTo: self maxClassPlusSelectorSize - className size);
  				cr]!



More information about the Squeak-dev mailing list