help-octave
[Top][All Lists]
Advanced

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

Re: How to test for "integer"?


From: Keith Goodman
Subject: Re: How to test for "integer"?
Date: Sun, 15 May 2005 13:39:03 -0700

I don't know of a built-in isint function.

But you can make your own. I'd use floor(x)==x since floor is a
built-in function but mod isn't. Plus it won't crash on complex
numbers. Either way I don't think you need abs.

On 5/15/05, Robert A. Macy <address@hidden> wrote:
> Group,
> 
> Is there a direct test for integer?
> 
> I've been using
> 
> if (abs(mod(n,1))==0)
>   msg="n is an integer"
> endif
> 
> which works great.
> 
> I looked through the octave manual and didn't recognize an
> "integer" test.
> 
>                - Robert -
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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