Skip to content

Commit a69b655

Browse files
Added a test demonstrating that the square root of a negative real number is pure imaginary.
1 parent 33bfd2c commit a69b655

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Math-Tests-Complex/PMComplexTest.class.st

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,15 @@ PMComplexTest >> testSinh [
617617
self assert: (c sinh imaginary closeTo: c2 imaginary).
618618
]
619619

620+
{ #category : #tests }
621+
PMComplexTest >> testSquareRootOfANegativeRealNumberIsPureImaginary [
622+
"Given z = -4 + 0 i, the square root is 2 i"
623+
624+
| squareRoot |
625+
squareRoot := (PMComplex real: -4 imaginary: 0) sqrt .
626+
self assert: squareRoot equals: 2 i.
627+
]
628+
620629
{ #category : #tests }
621630
PMComplexTest >> testSquared [
622631
"self run: #testSquared"

0 commit comments

Comments
 (0)