[squeak-dev] The Trunk: Kernel-cmm.758.mcz

Bert Freudenberg bert at freudenbergs.de
Fri May 3 16:53:51 UTC 2013


On 2013-05-03, at 16:44, commits at source.squeak.org wrote:

> 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.

We already established that my MC mod does not match your old workflow ;)

OTOH, I do prefer this to be two separate commits, because they have nothing to do with each other, except that they happen to be in the same package. 

- Bert -



>  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 Squeak-dev mailing list