#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Mon, 12 Jun 2017 20:45:26 +0200
changeset 21798 eeac3e49a0af
parent 21797 770933d4f13a
child 21799 e512db43c3d7
#DOCUMENTATION by cg class: Complex comment/format in: #= #equalFromComplex: #equalFromFloat: #productFromInteger: class: Complex class comment/format in: #fromReal: #imaginary: #real: #real:imaginary:
Complex.st
--- a/Complex.st	Mon Jun 12 20:39:15 2017 +0200
+++ b/Complex.st	Mon Jun 12 20:45:26 2017 +0200
@@ -111,6 +111,12 @@
     "Create a new complex number from the given real number."
 
     ^ self basicNew setReal: aNumber setImaginary: 0
+
+    "
+     Complex fromReal:1.0 
+    "
+
+    "Modified (comment): / 12-06-2017 / 20:42:56 / cg"
 !
 
 imaginary: v
@@ -119,12 +125,25 @@
 
     v = 0 ifTrue: [^ 0].
     ^ self basicNew setReal: 0 setImaginary: v
+
+    "
+     Complex imaginary:1.0 
+     (0.0 % 1.0)
+    "
+
+    "Modified (comment): / 12-06-2017 / 20:44:51 / cg"
 !
 
 real: aNumber
     "Create a new complex number from the given real number."
 
     ^ self basicNew setReal: aNumber setImaginary: 0
+
+    "
+     Complex real:1.0 
+    "
+
+    "Modified (comment): / 12-06-2017 / 20:42:14 / cg"
 !
 
 real: u imaginary: v
@@ -133,6 +152,13 @@
 
     v = 0 ifTrue: [^ u].
     ^ self basicNew setReal: u setImaginary: v
+
+    "
+     Complex real:1.0 imaginary:2.0
+     (1.0 % 2.0)
+    "
+
+    "Modified (comment): / 12-06-2017 / 20:44:32 / cg"
 ! !
 
 !Complex class methodsFor:'constants access'!
@@ -379,6 +405,13 @@
      as the receiver, false otherwise."
 
     ^ aNumber equalFromComplex:self
+
+    "
+     (Complex real:1.0 imaginary:2.0) = (Complex real:1.0 imaginary:2.0)
+     (Complex real:1.0 imaginary:0) = 1.0
+    "
+
+    "Modified (comment): / 12-06-2017 / 20:43:41 / cg"
 !
 
 hash
@@ -483,12 +516,20 @@
 !
 
 equalFromComplex:aComplex
+    "return true if aComplex represents the same number as myself"
+
     ^ (aComplex real = real) and:[aComplex imaginary = imaginary]
+
+    "Modified (comment): / 12-06-2017 / 20:41:04 / cg"
 !
 
 equalFromFloat:aFloat
+    "return true if aFloat represents the same number as myself"
+
     imaginary = 0 ifFalse:[^ false].
     ^ real = aFloat
+
+    "Modified (comment): / 12-06-2017 / 20:41:00 / cg"
 !
 
 productFromComplex:aComplex
@@ -537,9 +578,12 @@
 !
 
 productFromInteger: anInteger
-    "Return the product of the receiver and the argument, anInteger."
+    "sent when an integer does not know how to multiply the receiver, a complex.
+     Return the product of the receiver and the argument, anInteger."
 
     ^ anInteger asComplex * self
+
+    "Modified (comment): / 12-06-2017 / 20:30:20 / cg"
 !
 
 quotientFromComplex:aComplex