Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1906 serge 1
/*
2
FUNCTION
3
   <>, <>---string to double or float
4
 
5
INDEX
6
	atof
7
INDEX
8
	atoff
9
 
10
ANSI_SYNOPSIS
11
	#include 
12
        double atof(const char *<[s]>);
13
        float atoff(const char *<[s]>);
14
 
15
TRAD_SYNOPSIS
16
	#include 
17
        double atof(<[s]>)
18
        char *<[s]>;
19
 
20
        float atoff(<[s]>)
21
        char *<[s]>;
22
 
23
DESCRIPTION
24
<> converts the initial portion of a string to a <>.
25
<> converts the initial portion of a string to a <>.
26
 
27
The functions parse the character string <[s]>,
28
locating a substring which can be converted to a floating-point
29
value. The substring must match the format:
30
. [+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]
31
The substring converted is the longest initial
32
fragment of <[s]> that has the expected format, beginning with
33
the first non-whitespace character.  The substring
34
is empty if <> is empty, consists entirely
35
of whitespace, or if the first non-whitespace character is
36
something other than <<+>>, <<->>, <<.>>, or a digit.
37
 
38
<)>> is implemented as <, NULL)>>.
39
<)>> is implemented as <, NULL)>>.
40
 
41
RETURNS
42
<> returns the converted substring value, if any, as a
43
<>; or <<0.0>>,  if no conversion could be performed.
44
If the correct value is out of the range of representable values, plus
45
or minus <> is returned, and <> is stored in
46
<>.
47
If the correct value would cause underflow, <<0.0>> is returned
48
and <> is stored in <>.
49
 
50
<> obeys the same rules as <>, except that it
51
returns a <>.
52
 
53
PORTABILITY
54
<> is ANSI C. <>, <>, and <> are subsumed by <>
55
and <>, but are used extensively in existing code. These functions are
56
less reliable, but may be faster if the argument is verified to be in a valid
57
range.
58
 
59
Supporting OS subroutines required: <>, <>, <>,
60
<>, <>, <>, <>.
61
*/
62
 
63
 
64
#include 
65
#include <_ansi.h>
66
 
67
double
68
_DEFUN (atof, (s),
69
	_CONST char *s)
70
{
71
  return strtod (s, NULL);
72
}