Re: result type of power operator...

From: Dennis Marsa (drm@xilinx.com)
Date: Fri Mar 01 2002 - 08:34:42 PST


Precedence: bulk

Paul Graham wrote:
>
> I think that the rule about exponentiation was intended to cover the case of
> a negative exponent. So:
>
> x ** -1
>
> will generally be a real number. The text:
>
> The result of the power operator shall be real if either operand is a
> real,integer,or signed.
>
> should be changed to read:
>
> The result of the power operator shall be real if either operand is
> real, or if the second operand is negative.

I like first part (result is real if either operand is real),
but not the second. The second operand could be a variable,
and at compilation time we would not necessarily know if it
is negative or not.

   integer x, y;

   x ** y; // real or integer?

Shouldn't the result type be determinable statically?

Dennis



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:55:35 PDT and
sponsored by Boyd Technology, Inc.