[squeak-dev] The Inbox: Kernel-cbc.593.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 8 05:26:38 UTC 2011


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-cbc.593.mcz

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

Name: Kernel-cbc.593
Author: cbc
Time: 7 June 2011, 10:25:11.435 pm
UUID: 6ea87b7a-6755-1446-b2fd-54350609142c
Ancestors: Kernel-wiz.592

Added examples to the comments in Number #roundDownTo:, #roundUpTo:, and #truncateTo: to clarify how to use the methods.

=============== Diff against Kernel-wiz.592 ===============

Item was changed:
  ----- Method: Number>>roundDownTo: (in category 'truncation and round off') -----
  roundDownTo: aNumber 
  	"Answer the next multiple of aNumber toward negative infinity that is nearest the 
  	receiver."
+  	"Examples:
+ 		3.1479 roundDownTo: 0.01 -> 3.14
+ 		3.1479 roundDownTo: 0.1 -> 3.1
+ 		1923 roundDownTo: 10 -> 1920
+ 		3.1479 roundDownTo: 0.005 -> 3.145
+ 		-3.1479 roundDownTo: 0.01 -> -3.15"
+ 		
- 
  	^(self/aNumber) floor * aNumber!

Item was changed:
  ----- Method: Number>>roundUpTo: (in category 'truncation and round off') -----
  roundUpTo: aNumber 
  	"Answer the next multiple of aNumber toward infinity that is nearest the 
  	receiver."
+  	"Examples:
+ 		3.1479 roundUpTo: 0.01 -> 3.15
+ 		3.1479 roundUpTo: 0.1 -> 3.2
+ 		1923 roundUpTo: 10 -> 1930
+ 		3.1479 roundUpTo: 0.005 -> 3.15
+ 		-3.1479 roundUpTo: 0.01 -> -3.14"
  
  	^(self/aNumber) ceiling * aNumber!

Item was changed:
  ----- Method: Number>>truncateTo: (in category 'truncation and round off') -----
  truncateTo: aNumber 
  	"Answer the next multiple of aNumber toward zero that is nearest the 
  	receiver."
+ 	"Examples:
+ 		3.1479 truncateTo: 0.01 -> 3.14
+ 		3.1479 truncateTo: 0.1 -> 3.1
+ 		1923 truncateTo: 10 -> 1920
+ 		3.1479 truncateTo: 0.005 -> 3.145
+ 		-3.1479 truncateTo: 0.01 -> -3.14"
  
  	^(self quo: aNumber)
  		* aNumber!




More information about the Squeak-dev mailing list