octave-maintainers
[Top][All Lists]
Advanced

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

No isimag() curioso


From: Daniel J Sebald
Subject: No isimag() curioso
Date: Fri, 07 Sep 2012 16:30:55 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

In working with the fftfilt() routine and wanting to know if the inputs were purely imaginary I wondered why there is no such thing as isimag(). It seems as though it would be as useful as or more useful than iscomplex().

Here's the thing: iscomplex() appears to be simply the complement of isreal(), unless I'm missing a more sophisticated use of syntax:

octave:5> x = 1
x =  1
octave:6> [isreal(x) iscomplex(x)]
ans =

   1   0

octave:7> x = i
x =  0 + 1i
octave:8> [isreal(x) iscomplex(x)]
ans =

   0   1

octave:9> x = 1+i
x =  1 + 1i
octave:10> [isreal(x) iscomplex(x)]
ans =

   0   1

octave:11>

I ask, What's the point of having a function that is simply !isreal()? On the other hand isimag(), which is equivalent to "all (real (x) == 0)) && !isreal (x)", would be a nice shorthand.

Just an observation. Usually duplication of function (or its complement) is weeded out of programming languages.

Dan


reply via email to

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