atoreal - convert ASCII to REAL value


#include REAL atoreal (sptr) char *sptr;


This function converts a string pointed to by sptr to a REAL value. Atoreal first tries to convert sptr with the format returned by getfreal(C-3). If this fails, atoreal applies a set of standard input rules. The standard input rules allow an optional string of tabs and spaces, then an optional minus sign, then a string of digits optionally containing a decimal separator character (returned by getfdec(C-3)). The string may also contain one or more of the thousands separator character (returned by getfthou(C-3)) to make the number more readable. Atoreal returns the equivalent double floating point value. The advantages of using atoreal over atof(3) is that atoreal understands special formats and special characters for the defined country, and it accepts a number containing embedded thousands separator characters (commas for U.S.A. formats). For atoreal, the first unrecognized character ends the string.


fcountry(C-3), getfreal(C-3), getfthou(C-3), getfdec(C-3), fatoreal(C-3), atof(3) C/Base Reference Manual Chapter 13, "Formatting Data Values" DIAGNOSTICS A value of zero is returned for any conversion error.