Semantics of ^^

Bill Baxter wbaxter at gmail.com
Tue Dec 8 14:56:06 PST 2009


On Tue, Dec 8, 2009 at 1:58 PM, Phil Deets <pjdeets2 at gmail.com> wrote:
> On Tue, 08 Dec 2009 16:44:46 -0500, Phil Deets <pjdeets2 at gmail.com> wrote:
>
>> I think n is always non-negative in the trig series, but some Laurent
>> series use negative n values. So (-1)^^n might be useful for negative n, but
>> you could always rewrite it as (n%2 ? -1 : 1) or ~(n&1)+1.
>
> Oops, ~(n&1)+1 doesn't work, but ~((n&1)<<1)+2 does.

Right, and you can always write x^^y as pow(x,y).  A major point of
opPow is to avoid unnatural wonky-isms like you what you wrote there.

--bb



More information about the Digitalmars-d mailing list