[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
oct and inegers
From: |
John W. Eaton |
Subject: |
oct and inegers |
Date: |
Wed, 7 Jan 2004 16:09:39 -0600 |
On 7-Jan-2004, Claudio Belotti <address@hidden> wrote:
| I have an oct functions reading some files and returning data to
| octave (some of the values are integers, int32_t) after some
| operations I send the data back to the oct function; is there a way
| to understand if an octave_value is an integer or a double?
Unless you are using some add-on package that provides a special
integer data type, all numbers in Octave are stored internally as
double precision floating point values. So you have to do something
like
if (round (x) == x)
or, in a C++ file, I typically use
if (NINT (x) == x)
(NINT is a macro defined in liboctave/lo-utils.h).
jwe
-------------------------------------------------------------
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
-------------------------------------------------------------
- oct and inegers, Claudio Belotti, 2004/01/07
- oct and inegers,
John W. Eaton <=