2002-12-06 Jeff Johnston <jjohnstn@redhat.com>

* libc/include/stdlib.h (strtof): New prototype (from C99).
        (strtodf): Changed from prototype to macro which redefines
        to strtof.
        * libc/stdlib/atof.c: Change documentation to refer to strtof
        instead of strtodf.
        * libc/stdlib/atoff.c (atoff): Change to call strtof instead of
        strtodf.
        * libc/stdlib/strtod.c (strtodf): Renamed to strtof.
        (strtof): New function.
        * libm/test/convert.c (test_strtodf): Renamed to test_strtof which
        calls strtof.
This commit is contained in:
Jeff Johnston 2002-12-06 18:58:51 +00:00
parent e25e377eb3
commit c049dd5a78
6 changed files with 31 additions and 13 deletions

View File

@ -1,3 +1,17 @@
2002-12-06 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdlib.h (strtof): New prototype (from C99).
(strtodf): Changed from prototype to macro which redefines
to strtof.
* libc/stdlib/atof.c: Change documentation to refer to strtof
instead of strtodf.
* libc/stdlib/atoff.c (atoff): Change to call strtof instead of
strtodf.
* libc/stdlib/strtod.c (strtodf): Renamed to strtof.
(strtof): New function.
* libm/test/convert.c (test_strtodf): Renamed to test_strtof which
calls strtof.
2002-11-27 Christopher Faylor <cgf@redhat.com> 2002-11-27 Christopher Faylor <cgf@redhat.com>
* libc/string/memset.c (memset): Fix comment. * libc/string/memset.c (memset): Fix comment.

View File

@ -93,8 +93,12 @@ _PTR _EXFUN(realloc,(_PTR __r, size_t __size));
_VOID _EXFUN(srand,(unsigned __seed)); _VOID _EXFUN(srand,(unsigned __seed));
double _EXFUN(strtod,(const char *__n, char **__end_PTR)); double _EXFUN(strtod,(const char *__n, char **__end_PTR));
double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR)); double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR));
float _EXFUN(strtof,(const char *__n, char **__end_PTR));
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
float _EXFUN(strtodf,(const char *__n, char **__end_PTR)); /* the following strtodf interface is deprecated...use strtof instead */
# ifndef strtodf
# define strtodf strtof
# endif
#endif #endif
long _EXFUN(strtol,(const char *__n, char **__end_PTR, int __base)); long _EXFUN(strtol,(const char *__n, char **__end_PTR, int __base));
long _EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base)); long _EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base));

View File

@ -36,7 +36,7 @@ of whitespace, or if the first non-whitespace character is
something other than <<+>>, <<->>, <<.>>, or a digit. something other than <<+>>, <<->>, <<.>>, or a digit.
<<atof(<[s]>)>> is implemented as <<strtod(<[s]>, NULL)>>. <<atof(<[s]>)>> is implemented as <<strtod(<[s]>, NULL)>>.
<<atoff(<[s]>)>> is implemented as <<strtodf(<[s]>, NULL)>>. <<atoff(<[s]>)>> is implemented as <<strtof(<[s]>, NULL)>>.
RETURNS RETURNS
<<atof>> returns the converted substring value, if any, as a <<atof>> returns the converted substring value, if any, as a

View File

@ -5,5 +5,5 @@ float
_DEFUN (atoff, (s), _DEFUN (atoff, (s),
_CONST char *s) _CONST char *s)
{ {
return strtodf (s, NULL); return strtof (s, NULL);
} }

View File

@ -1,18 +1,18 @@
/* /*
FUNCTION FUNCTION
<<strtod>>, <<strtodf>>---string to double or float <<strtod>>, <<strtof>>---string to double or float
INDEX INDEX
strtod strtod
INDEX INDEX
_strtod_r _strtod_r
INDEX INDEX
strtodf strtof
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdlib.h> #include <stdlib.h>
double strtod(const char *<[str]>, char **<[tail]>); double strtod(const char *<[str]>, char **<[tail]>);
float strtodf(const char *<[str]>, char **<[tail]>); float strtof(const char *<[str]>, char **<[tail]>);
double _strtod_r(void *<[reent]>, double _strtod_r(void *<[reent]>,
const char *<[str]>, char **<[tail]>); const char *<[str]>, char **<[tail]>);
@ -23,7 +23,7 @@ TRAD_SYNOPSIS
char *<[str]>; char *<[str]>;
char **<[tail]>; char **<[tail]>;
float strtodf(<[str]>,<[tail]>) float strtof(<[str]>,<[tail]>)
char *<[str]>; char *<[str]>;
char **<[tail]>; char **<[tail]>;
@ -48,7 +48,7 @@ DESCRIPTION
(which will contain at least the terminating null character of (which will contain at least the terminating null character of
<[str]>) is stored in <<*<[tail]>>>. If you want no <[str]>) is stored in <<*<[tail]>>>. If you want no
assignment to <<*<[tail]>>>, pass a null pointer as <[tail]>. assignment to <<*<[tail]>>>, pass a null pointer as <[tail]>.
<<strtodf>> is identical to <<strtod>> except for its return type. <<strtof>> is identical to <<strtod>> except for its return type.
This implementation returns the nearest machine number to the This implementation returns the nearest machine number to the
input decimal string. Ties are broken by using the IEEE input decimal string. Ties are broken by using the IEEE
@ -721,11 +721,11 @@ _DEFUN (strtod, (s00, se),
} }
float float
_DEFUN (strtodf, (s00, se), _DEFUN (strtof, (s00, se),
_CONST char *s00 _AND _CONST char *s00 _AND
char **se) char **se)
{ {
return _strtod_r (_REENT, s00, se); return (float)_strtod_r (_REENT, s00, se);
} }
#endif #endif

View File

@ -24,12 +24,12 @@ _DEFUN_VOID(test_strtod)
} }
void void
_DEFUN_VOID(test_strtodf) _DEFUN_VOID(test_strtof)
{ {
char *tail; char *tail;
double v; double v;
/* On average we'll loose 1/2 a bit, so the test is for within 1 bit */ /* On average we'll loose 1/2 a bit, so the test is for within 1 bit */
v = strtodf(pd->string, &tail); v = strtof(pd->string, &tail);
test_mok(v, pd->value, 32); test_mok(v, pd->value, 32);
test_iok(tail - pd->string, pd->endscan); test_iok(tail - pd->string, pd->endscan);
} }
@ -358,7 +358,7 @@ _DEFUN_VOID(test_cvt)
iterate(test_atof, "atof"); iterate(test_atof, "atof");
iterate(test_atoff, "atoff"); iterate(test_atoff, "atoff");
iterate(test_strtodf, "strtodf"); iterate(test_strtof, "strtof");
int_iterate(test_atoi,"atoi"); int_iterate(test_atoi,"atoi");
int_iterate(test_atol,"atol"); int_iterate(test_atol,"atol");