File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -638,6 +638,21 @@ PMComplexTest >> testSquareRootOfPositiveRealNumberIsAComplexNumberWithOnlyAReal
638638 self assert: squareRoot equals: expected
639639]
640640
641+ { #category : #tests }
642+ PMComplexTest >> testSquareRootOfPureImaginaryNumberIsAComplexNumberWithRealAndImaginaryParts [
643+
644+ " e.g. square root of 4 i = root(2) + i root(2)"
645+
646+ | squareRoot expected pureImaginaryNumber |
647+ pureImaginaryNumber := PMComplex real: 0 imaginary: 4 .
648+
649+ squareRoot := pureImaginaryNumber sqrt.
650+
651+ expected := 2 sqrt + 2 sqrt i.
652+ self assert: squareRoot real closeTo: expected real.
653+ self assert: squareRoot imaginary closeTo: expected imaginary
654+ ]
655+
641656{ #category : #tests }
642657PMComplexTest >> testSquareRootOfZeroIsZero [
643658 " comment stating purpose of instance-side method"
You can’t perform that action at this time.
0 commit comments