[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: COMPLEX: Summary and language extension



>  Date: Mon, 12 Feb 96 08:59:40 EST
>  From: Mike Griebling <grieblm@trt.allied.com>
>  
>  As an addition, the ABS() function could also be applied to both
>  COMPLEX and LONGCOMPLEX types to return the magnitude of the 
>  complex number.  Since ABS() is in the language anyway, it would
>  be a free function and make cartesian to polar conversions a bit
>  simpler and more efficient. BTW, ABS(z)=Sqrt(z.r*z.r+z.i*z.i).

This would mean to introduce either two opcodes abs_cmplx and
abs_longcmplx into GSA (if translating ABS into a single GSA
instruction), or to add opcodes for the sqrt function (if the
front-end turns the complex ABS into elementary real operations).  The
first option has the disadvantage of introducing opcodes dealing with
complex math.

I'd prefer to include complex ABS, just to have a general ABS function
that extends naturally to complex types.  But it's up to the back-end
people if (yes or no), and how (abs or sqrt opcodes), they want to
include the necessary math opcodes.

-- Michael