[Pkg] The Trunk: Kernel-cmm.758.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 3 16:45:41 UTC 2013


Chris Muller uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-cmm.758.mcz

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

Name: Kernel-cmm.758
Author: cmm
Time: 3 May 2013, 11:43:45.83 am
UUID: b64656cf-20bf-4bad-9fca-2750e1c67e67
Ancestors: Kernel-cmm.757

- Another ticky-tack commit because Monticello-bf.540 did not capture ALL package changes.  The comment for the prior package is wrong, it did not include this change because I failed to:

  1) Copy the change text to the clipboard
  2) click "Cancel"
  3) Find a MC browser.
  4) Click "Save"
  5) Re-paste the change text.

Please see my immediate ancestor for what this change is about.

=============== Diff against Kernel-cmm.757 ===============

Item was changed:
  ----- Method: Float class>>fromIEEE32Bit: (in category 'instance creation') -----
  fromIEEE32Bit: word
  	"Convert the given 32 bit word (which is supposed to be a positive 32bit value) from a 32bit IEEE floating point representation into an actual Squeak float object (being 64bit wide). Should only be used for conversion in FloatArrays or likewise objects."
  	
  	| sign mantissa exponent newFloat delta |
  	word negative ifTrue: [^ self error:'Cannot deal with negative numbers'].
+ 	word = 0 ifTrue: [^ Float zero].
- 	word = 0 ifTrue: [^ 0.0].
  	sign := word bitAnd: 16r80000000.
  	word = sign ifTrue: [^self negativeZero].
  	
  	exponent := ((word bitShift: -23) bitAnd: 16rFF) - 127.
  	mantissa := word bitAnd:  16r7FFFFF.
  
  	exponent = 128 ifTrue:["Either NAN or INF"
  		mantissa = 0 ifFalse:[^ Float nan].
  		sign = 0 
  			ifTrue:[^ Float infinity]
  			ifFalse:[^ Float infinity negated]].
  
  	exponent = -127 ifTrue: [
  		"gradual underflow (denormalized number)
  		Remove first bit of mantissa and adjust exponent"
  		delta := mantissa highBit.
  		mantissa := (mantissa bitShift: 1) bitAnd: (1 bitShift: delta) - 1.
  		exponent := exponent + delta - 23].
  	
  	"Create new float"
  	newFloat := self new: 2.
  	newFloat basicAt: 1 put: ((sign bitOr: (1023 + exponent bitShift: 20)) bitOr: (mantissa bitShift: -3)).
  	newFloat basicAt: 2 put: ((mantissa bitAnd: 7) bitShift: 29).
  	^newFloat!



More information about the Packages mailing list