# HG changeset patch # User Claus Gittinger # Date 1018533822 -7200 # Node ID d2ce5b0a1a7801b0dae26b94298c45894e16e60e # Parent d412a0eca7222dc72d8995c28f9056c70f495b1b comments diff -r d412a0eca722 -r d2ce5b0a1a78 Complex.st --- a/Complex.st Thu Apr 11 15:01:13 2002 +0200 +++ b/Complex.st Thu Apr 11 16:03:42 2002 +0200 @@ -1,5 +1,3 @@ -"{ Package: 'stx:goodies' }" - " This is a Manchester Goodie. It is distributed freely on condition that you observe these conditions in respect of the whole Goodie, and on @@ -20,6 +18,8 @@ make your live easier instead. NO WARRANTY. " +"{ Package: 'stx:goodies' }" + ArithmeticValue subclass:#Complex instanceVariableNames:'real imaginary' classVariableNames:'' @@ -53,9 +53,9 @@ documentation " -This is an implementation of complex numbers. A complex number has real and + This is an implementation of complex numbers. A complex number has real and imaginary parts which must be manipulated simultaneously in any numeric processing. - Complex numbers can be used in many of the same places that regular numbers + Complex numbers can be used in many of the same places that regular numbers can be used with one major exception of comparisons, since complex numbers cannot be directly compared for size (except through lengths of vectors (see absolute value)). @@ -67,6 +67,16 @@ Author: Kurt Hebel (hebel@uinova.cerl.uiuc.edu) " +! + +example +" + (5 % 7) real + (5 % 7) imaginary + (5 % 7) = 5 + (5 % 0) = 5 + (5.0 % 0) = 5 +" ! ! !Complex class methodsFor:'instance creation'! @@ -238,7 +248,8 @@ receiver: self selector: #< arg: aNumber - errorString: 'Complex numbers are not well ordered'! + errorString: 'Complex numbers are not well ordered' +! = aNumber ^ (aNumber real = real) and:[aNumber imaginary = imaginary] @@ -431,5 +442,5 @@ !Complex class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Complex.st,v 1.5 2000-03-02 14:14:56 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Complex.st,v 1.6 2002-04-11 14:03:42 cg Exp $' ! !