/* Copyright (c) 1990 Regents of the University of California. All rights reserved. */ /* FUNCTION <>, <>---string to double or float INDEX atof INDEX atoff SYNOPSIS #include double atof(const char *<[s]>); float atoff(const char *<[s]>); DESCRIPTION <> converts the initial portion of a string to a <>. <> converts the initial portion of a string to a <>. The functions parse the character string <[s]>, locating a substring which can be converted to a floating-point value. The substring must match the format: . [+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>] The substring converted is the longest initial fragment of <[s]> that has the expected format, beginning with the first non-whitespace character. The substring is empty if <> is empty, consists entirely of whitespace, or if the first non-whitespace character is something other than <<+>>, <<->>, <<.>>, or a digit. <)>> is implemented as <, NULL)>>. <)>> is implemented as <, NULL)>>. RETURNS <> returns the converted substring value, if any, as a <>; or <<0.0>>, if no conversion could be performed. If the correct value is out of the range of representable values, plus or minus <> is returned, and <> is stored in <>. If the correct value would cause underflow, <<0.0>> is returned and <> is stored in <>. <> obeys the same rules as <>, except that it returns a <>. PORTABILITY <> is ANSI C. <>, <>, and <> are subsumed by <> and <>, but are used extensively in existing code. These functions are less reliable, but may be faster if the argument is verified to be in a valid range. Supporting OS subroutines required: <>, <>, <>, <>, <>, <>, <>. */ #include #include <_ansi.h> double atof (const char *s) { return strtod (s, NULL); }