File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,12 @@ PMComplex >> isNumber [
557557 ^ true
558558]
559559
560+ { #category : #' mathematical functions' }
561+ PMComplex >> isReal [
562+
563+ ^ imaginary = 0 and : [ real >= 0 ]
564+ ]
565+
560566{ #category : #testing }
561567PMComplex >> isZero [
562568 ^ real isZero and : [imaginary isZero]
@@ -707,14 +713,14 @@ PMComplex >> sinh [
707713
708714{ #category : #' mathematical functions' }
709715PMComplex >> sqrt [
716+
710717 " Return the square root of the receiver with a positive imaginary part."
711718
712719 | u v |
713- (imaginary = 0 and : [real >= 0 ])
714- ifTrue: [^ self class real: real sqrt imaginary: 0 ].
720+ self isReal ifTrue: [ ^ self class real: real sqrt imaginary: 0 ].
715721 v := (self abs - real / 2 ) sqrt.
716722 u := imaginary / 2 / v.
717- ^ self class real: u imaginary: v
723+ ^ self class real: u imaginary: v
718724]
719725
720726{ #category : #' mathematical functions' }
You can’t perform that action at this time.
0 commit comments