Complex.st
branchjv
changeset 21024 8734987eb5c7
parent 20578 39641ba8d6e0
parent 20740 f6574113b828
child 21242 19fabe339f8b
--- a/Complex.st	Wed Oct 26 23:35:39 2016 +0100
+++ b/Complex.st	Fri Nov 18 20:48:04 2016 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  This is a Manchester Goodie.  It is distributed freely on condition
  that you observe these conditions in respect of the whole Goodie, and on
@@ -449,6 +447,10 @@
     ^ self class real:r imaginary:i.
 !
 
+differenceFromFixedPoint: aFixedPoint
+    ^ aFixedPoint asComplex - self
+!
+
 differenceFromFloat:aFloat
     "Return the difference of the argument, aFloat and the receiver."
 
@@ -496,6 +498,10 @@
     ^ self class real:r imaginary:i
 !
 
+productFromFixedPoint: aFixedPoint
+    ^ aFixedPoint asComplex * self
+!
+
 productFromFloat: aFloat
     "Return the product of the receiver and the argument, aFloat."
 
@@ -559,6 +565,12 @@
 "/                imaginary: ((aComplex imaginaryPart * quotient) - aComplex realPart) / denominator ]
 !
 
+quotientFromFixedPoint:aFixedPoint
+    "Return the quotient of the argument, aFixedPoint and the receiver."
+
+    ^ aFixedPoint asComplex / self
+!
+
 quotientFromFloat:aFloat
     "Return the quotient of the argument, aFloat and the receiver."
 
@@ -588,6 +600,10 @@
     ^ self class real:r imaginary:i
 !
 
+sumFromFixedPoint: aFixedPoint
+    ^ aFixedPoint asComplex + self
+!
+
 sumFromFloat: aFloat
     "Return the sum of the receiver and the argument, aFloat."