From help-octave-request at bevo dot che dot wisc dot edu Mon Jan 5 19:46:55 2004 Subject: scanf fully IEEE 754 compliant ? From: "Pascal A. Dupuis" To: help-octave at bevo dot che dot wisc dot edu Date: Thu, 11 Dec 2003 07:51:26 -0600 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 -------------------------------------------------------------