[Pkg] The Trunk: Kernel-nice.285.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Oct 31 16:22:38 UTC 2009


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

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

Name: Kernel-nice.285
Author: nice
Time: 31 October 2009, 5:21:55 am
UUID: a71e2eb9-aade-4ec1-8c30-77e6c9eaf9c8
Ancestors: Kernel-ar.284

store a Float exactly so it can be interpreted back unchanged - according to my solution proposed at http://bugs.squeak.org/view.php?id=1631

Note that SqNumberParser SHOULD be used for interpreting the Number exactly.
Previous Number>>readFrom: accumulate roundoff errors

=============== Diff against Kernel-ar.284 ===============

Item was changed:
  ----- Method: Float>>storeOn:base: (in category 'printing') -----
+ storeOn: aStream base: base 
+ 	"Print the Number exactly so it can be interpreted back unchanged"
+ 	self isFinite
+ 		ifTrue: [self > 0
+ 				ifTrue: [self absPrintExactlyOn: aStream base: base]
+ 				ifFalse: [self sign = -1
+ 						ifTrue: [aStream nextPutAll: '-'].
+ 					self = 0.0
+ 						ifTrue: [aStream nextPutAll: '0.0']
+ 						ifFalse: [self negated absPrintExactlyOn: aStream base: base]]]
+ 		ifFalse: [self isNaN
+ 				ifTrue: [aStream nextPutAll: 'Float nan']
+ 				ifFalse: [self > 0.0
+ 						ifTrue: [aStream nextPutAll: 'Float infinity']
+ 						ifFalse: [aStream nextPutAll: 'Float infinity negated']]]!
- storeOn: aStream base: base
- 	"Defined here to handle special cases of NaN Infinity and negative zero"
- 	
- 	| abs |
- 	self isNaN ifTrue: [aStream nextPutAll: 'NaN'. ^ self]. "check for NaN before sign"
- 	abs := self sign = -1 "Test sign rather than > 0 for special case of negative zero"
- 		ifTrue:
- 			[aStream nextPutAll: '-'.
- 			self negated]
- 		 ifFalse: [self].
- 	abs isInfinite ifTrue: [aStream nextPutAll: 'Infinity'. ^ self].
- 	aStream print: base; nextPut: $r.
- 	self = 0.0
- 		ifTrue: [aStream nextPutAll: '0.0'. ^ self]
- 		ifFalse: [abs absPrintOn: aStream base: base]!

Item was added:
+ ----- Method: Float>>storeOn: (in category 'printing') -----
+ storeOn: aStream 
+ 	"Print the Number exactly so it can be interpreted back unchanged"
+ 	
+ 	self storeOn: aStream base: 10!



More information about the Packages mailing list