NAME
ss1snf - Scan a float from a string in scientific notation
SYNOPSIS
#include "l/l_sys_scan.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int ss1snf
(
const char *input_str,
float *float_ptr
);
DESCRIPTION
This routine reads a float from a string in scientific notation with more
sophisticated error reporting that available using scanf. If the contents of
"str" is exactly one number which is appropriate for a float, then it sets
*float_ptr to that number and returns NO_ERROR. Otherwise and error message
is set, and ERROR is returned. The contents of *float_ptr are only changed
on success.
If str is either "off" or "none", then the special value DBL_NOT_SET is
returned. Otherwise, str must contain a single valid number, possibly
followed by a "%". If str ends with a "%", then the number is assumed to be
a percentage, and the result is divided by 100.0.
RETURNS
If "str" represents a valid float, then NO_ERROR is returned. Otherwise
the problem with "str" is reported in the set error message, and ERRROR is
returned. The problem with "str" can be printed with kjb_print_error.
NOTE
For successful return, "str" cannot contain two numbers. For example, it
can't be something like "1 2".
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTER
Kobus Barnard
SEE ALSO
ss1ul
,
ss1l
,
ss1spl
,
ss1pl
,
ss1pl_2
,
ss1ui
,
ss1i
,
ss1spi
,
ss1pi
,
ss1pi_2
,
ss1us
,
ss1s
,
ss1sps
,
ss1ps
,
ss1ps_2
,
ss1f
,
ss1d
,
ss1snd