[BUGLET] in Float>raisedTo: (small correction)

Florin Mateoc Florin at integral.com
Sat Feb 20 00:53:30 UTC 1999

Sorry, in the last message I missed two right brackets.

The method now also returns the same kind of zero as the original
base. (So 0.0 raisedTo: 0.75 now returns 0.0 (not 0, as in the
previous version, nor -0.0 as in the original bug (but the check
self=0 here is not for dealing with that bug, it's for the two
error conditions specific to raiseTo:. Obviously Float>>ln still
fails to fail for negative numbers, but that's a primitive problem)))

raisedTo: aNumber
	self = 0 ifTrue: [
		aNumber negative
			ifTrue: [^self error: 'attempt to divide by zero']
			ifFalse: [
				aNumber = 0
					ifTrue: [^self error: '0 raisedTo:
					ifFalse: [^self]]].
	(aNumber = aNumber asInteger)
		ifTrue: ["Do the special case of integer power"
				^self raisedToInteger: aNumber asInteger].
	^(aNumber asFloat * self ln) exp


More information about the Squeak-dev mailing list