[squeak-dev] The Trunk: Kernel-nice.695.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 6 23:21:52 UTC 2012


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

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

Name: Kernel-nice.695
Author: nice
Time: 7 June 2012, 1:20:38.119 am
UUID: 6e5aa981-c989-4ac5-9f18-542a7360f3a9
Ancestors: Kernel-nice.694

Provides a new version of significandAsInteger that relies on regular Float arithmetic and regular asInteger conversion.
In case of exceptional values, use the old behaviour, that is directly extract the bit pattern, but without implied one at position 53.
Marginally faster than old version - sorry, not significantly.

=============== Diff against Kernel-nice.694 ===============

Item was changed:
  ----- Method: Float>>significandAsInteger (in category 'truncation and round off') -----
  significandAsInteger
+ 	"Answer the mantissa of a Float shifted so as to have the ulp equal to 1.
+ 	For exceptional values, infinity and nan, just answer the bit pattern."
  
+ 	self isFinite ifTrue:
+ 		[^(self timesTwoPower: self class precision - 1 - (self exponent max: self class emin)) truncated abs].
+ 	^(((self basicAt: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self basicAt: 2)!
- 	| exp sig |
- 	exp := self exponent.
- 	sig := (((self at: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self at: 2).
- 	(exp > -1023 and: [self ~= 0.0])
- 		ifTrue: [sig := sig bitOr: (1 bitShift: 52)].
- 	^ sig.!



More information about the Squeak-dev mailing list