1 |
/* Implementation of strtod for systems with atof. |
/* Implementation of strtod for systems with atof. |
2 |
Copyright (C) 1991, 1995 Free Software Foundation, Inc. |
Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of the libiberty library. This library is free |
This file is part of the libiberty library. This library is free |
5 |
software; you can redistribute it and/or modify it under the |
software; you can redistribute it and/or modify it under the |
22 |
This exception does not however invalidate any other reasons why |
This exception does not however invalidate any other reasons why |
23 |
the executable file might be covered by the GNU General Public License. */ |
the executable file might be covered by the GNU General Public License. */ |
24 |
|
|
25 |
|
/* |
26 |
|
|
27 |
|
@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr}) |
28 |
|
|
29 |
|
This ISO C function converts the initial portion of @var{string} to a |
30 |
|
@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the |
31 |
|
character after the last character used in the conversion is stored in |
32 |
|
the location referenced by @var{endptr}. If no conversion is |
33 |
|
performed, zero is returned and the value of @var{string} is stored in |
34 |
|
the location referenced by @var{endptr}. |
35 |
|
|
36 |
|
@end deftypefn |
37 |
|
|
38 |
|
*/ |
39 |
|
|
40 |
#include "ansidecl.h" |
#include "ansidecl.h" |
41 |
#include "safe-ctype.h" |
#include "safe-ctype.h" |
42 |
|
|
75 |
&& (p[6] == 't' || p[6] == 'T') |
&& (p[6] == 't' || p[6] == 'T') |
76 |
&& (p[7] == 'y' || p[7] == 'Y')) |
&& (p[7] == 'y' || p[7] == 'Y')) |
77 |
{ |
{ |
78 |
*ptr = p + 7; |
*ptr = p + 8; |
79 |
return atof (str); |
return atof (str); |
80 |
} |
} |
81 |
else |
else |