dbb@aicchi.UUCP (Burch) (03/01/86)
Well, this is a class for NEON V1.5 that makes use of the Float class from
the NeonFP.com file. I will be implementing complex trig functions some
time soon, but felt that this would be immediately useful. Enjoy... Also,
I would appreciate seeing ANY NEON code posted... You never know who might
be able to use it...
----------------------------------------------------------------------------
\ Class Complex, Complex number class using floating point support
\ 02/28/86 David B. (Ben) Burch, Copyright 1986, All rights reserved
\ Permission to copy is granted providing the above copyright is left
\ intact.
Decimal
:CLASS Complex <Super Object
Float RealN
Float ImagN
\
\ Accessing -- Note that the Real portion should be on top of
\ the stack for a put... This means that you should
\ type the Imaginary part *FIRST*...
\
:M get: get: ImagN get: RealN ;M
:M put: put: RealN put: ImagN ;M
:M =: { Cplx -- } get: Self put: Cplx ;M
:M getr: get: RealN ;M
:M geti: get: ImagN ;M
:M putr: put: RealN ;M
:M puti: put: ImagN ;M
\
\ Display
\
:M print: ." (" print: RealN ." ," print: ImagN ." )" ;M
:M printr: print: RealN ;M
:M printi: print: ImagN ;M
\
\ Arithmetic - Note that these methods expect the pointer to an
\ object to be on top of the stack, two floaters
\ won't do...
\
:M +: { Cplx -- } getr: Cplx +: RealN
geti: Cplx +: ImagN ;M
:M -: { Cplx -- } getr: Cplx -: RealN
geti: Cplx -: ImagN ;M
:M *: { Cplx -- } getr: Cplx get: RealN f*
geti: Cplx get: ImagN f* f-
getr: Cplx get: ImagN f*
geti: Cplx get: RealN f* f+
put: ImagN put: RealN ;M
:M /: { Cplx -- }
get: RealN getr: Cplx f*
get: ImagN geti: Cplx f* f+
getr: Cplx getr: Cplx f*
geti: Cplx geti: Cplx f* f+ f/
get: ImagN getr: Cplx f*
get: RealN geti: Cplx f* f-
getr: Cplx getr: Cplx f*
geti: Cplx geti: Cplx f* f+ f/
put: ImagN put: RealN ;M
;CLASS
--
-David B. (Ben) Burch
Analyst's International Corp.
Chicago Branch (ihnp4!aicchi!dbb)
"Argue for your limitations, and they are yours"