ss1f - Scan a float from a string in fixed decimal format


#include "l/l_sys_scan.h"

Example compile flags (system dependent):
   -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 ss1f
	const char *input_str,
	float *float_ptr


This routine reads a float from a string in fixed decimal format 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.


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.


For successful return, "str" cannot contain two numbers. For example, it can't be something like "1 2".


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


ss1ul , ss1l , ss1spl , ss1pl , ss1pl_2 , ss1ui , ss1i , ss1spi , ss1pi , ss1pi_2 , ss1us , ss1s , ss1sps , ss1ps , ss1ps_2 , ss1snf , ss1d , ss1snd