File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -626,9 +626,9 @@ PMComplexNumber >> raisedTo: index [
626626
627627 index isInteger ifTrue: [ ^ self raisedToInteger: index ].
628628
629- 0 = index ifTrue: [ ^ self class one ]. " Special case of exponent=0 "
630- 1 = index ifTrue: [ ^ self ]. " Special case of exponent=1 "
631- 0 = self ifTrue: [ " Special case of self = 0 "
629+ 0 = index ifTrue: [ ^ self class one ].
630+ 1 = index ifTrue: [ ^ self ].
631+ 0 = self ifTrue: [
632632 ^ index < 0
633633 ifTrue: [ (ZeroDivide dividend: self ) signal ]
634634 ifFalse: [ self ] ].
Original file line number Diff line number Diff line change @@ -670,6 +670,13 @@ PMComplexNumberTest >> testRaisedToPositiveInteger [
670670 self assert: zCubed closeTo: (0 + 1 i).
671671]
672672
673+ { #category : #' testing - mathematical functions' }
674+ PMComplexNumberTest >> testRaisingZeroToThePowerOfNegativeIndex [
675+ | zero |
676+ zero := PMComplexNumber zero.
677+ self should: [ zero raisedTo: - 4 ] raise: ZeroDivide
678+ ]
679+
673680{ #category : #tests }
674681PMComplexNumberTest >> testRandom [
675682 | random c r |
You can’t perform that action at this time.
0 commit comments