help-octave
[Top][All Lists]
Advanced

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

Re: two_pi ?


From: Max Brister
Subject: Re: two_pi ?
Date: Thu, 23 Aug 2012 10:33:57 -0500

On Thu, Aug 23, 2012 at 4:27 AM, Sergei Steshenko <address@hidden> wrote:
>
>
> --- On Thu, 8/23/12, Lukas Reichlin <address@hidden> wrote:
>
>> From: Lukas Reichlin <address@hidden>
>> Subject: Re: two_pi ?
>> To: "Sergei Steshenko" <address@hidden>
>> Cc: address@hidden
>> Date: Thursday, August 23, 2012, 1:02 AM
>>
>> On 22.08.2012, at 23:58, Sergei Steshenko wrote:
>>
>> > Hello,
>> >
>> > since I' dealing with signals/DSP a lot, and since by
>> definition
>> >
>> > omega = 2 * pi
>> >
>> > , in almost every script of mine I have
>> >
>> > two_pi = 2 * pi;
>> >
>> > line. And in many functions too, of course.
>> >
>> > Is there a built-in two_pi constant ? If not, would the
>> developers please introduce it ?
>> >
>> > Thanks,
>> >  Sergei.
>>
>> How about  2pi  ?
>>
>> It is possible to write  2i  instead of
>> 2*i  , so why not  2pi  instead of  2*
>> pi  ? I don't know whether it's hard to implement or if
>> there are any unwanted side effects, though.
>>
>> Lukas
>>
>>
>
> I meant not only name, but also constant folding, i.e. getting rid of 
> multiplication.
>
> OTOH, maybe Octave interpreter is smart enough to do constant folding ?

The Octave interpreter does do basic constant folding. I'm not sure if
2 * pi would be folded though, as pi is a function call.

> Thanks,
>   Sergei.

-- 
Max Brister


reply via email to

[Prev in Thread] Current Thread [Next in Thread]