[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scanf fully IEEE 754 compliant ?
From: |
Pascal A. Dupuis |
Subject: |
scanf fully IEEE 754 compliant ? |
Date: |
Thu, 11 Dec 2003 07:51:26 -0600 |
User-agent: |
Mutt/1.5.4i |
Hello,
I have a small problem/inquiry about octave. I need to parse a file
made of some header lines, then floats separated by tabs. Problem is,
the application generating the file sometimes put values like Inf,
+Inf, -Inf. At this point I've written some wrappers around scanf and
fscanf which try to detect the IEEE754 exceptions Inf and NaN in the
remaining of the string/file.
Life would be easier if the octave scanf/fscanf implementation take
care of such values, as currently there remain problems with the
workarounds:
- the fscanf wrapper needs the file to be rewindable, it can't be
applied to a pipe
- the scanf wrapper can't figure where the scan would finish, so it is a
mix of split() and index().
About portability: recent glibc-2.0 scanf and fscanf fully supports the
inf and nan values. Don't know about libstdc++ ?
Best regards
Pascal Dupuis
--
Dr. ir. Pascal Dupuis
K. U. Leuven, ESAT/ELECTA (formerly ELEN): http://www.esat.kuleuven.ac.be/
Kasteelpark Arenberg, 10; B-3001 Leuven-Heverlee, Belgium
Tel. +32-16-32 10 21 -- Fax +32-16-32 19 85
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scanf fully IEEE 754 compliant ?,
Pascal A. Dupuis <=