From c049dd5a782f36ca5f6eeb39e110d5774631aa1c Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 6 Dec 2002 18:58:51 +0000 Subject: 2002-12-06 Jeff Johnston * 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. --- newlib/libc/include/stdlib.h | 6 +++++- newlib/libc/stdlib/atof.c | 2 +- newlib/libc/stdlib/atoff.c | 2 +- newlib/libc/stdlib/strtod.c | 14 +++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'newlib/libc') diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index d6b14f2..3f0d003 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -93,8 +93,12 @@ _PTR _EXFUN(realloc,(_PTR __r, size_t __size)); _VOID _EXFUN(srand,(unsigned __seed)); double _EXFUN(strtod,(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__ -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 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)); diff --git a/newlib/libc/stdlib/atof.c b/newlib/libc/stdlib/atof.c index cf4abdb..bba343c 100644 --- a/newlib/libc/stdlib/atof.c +++ b/newlib/libc/stdlib/atof.c @@ -36,7 +36,7 @@ of whitespace, or if the first non-whitespace character is something other than <<+>>, <<->>, <<.>>, or a digit. <)>> is implemented as <, NULL)>>. -<)>> is implemented as <, NULL)>>. +<)>> is implemented as <, NULL)>>. RETURNS <> returns the converted substring value, if any, as a diff --git a/newlib/libc/stdlib/atoff.c b/newlib/libc/stdlib/atoff.c index 9c682c4..c97b78f 100644 --- a/newlib/libc/stdlib/atoff.c +++ b/newlib/libc/stdlib/atoff.c @@ -5,5 +5,5 @@ float _DEFUN (atoff, (s), _CONST char *s) { - return strtodf (s, NULL); + return strtof (s, NULL); } diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index c16d75d..19467f4 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -1,18 +1,18 @@ /* FUNCTION - <>, <>---string to double or float + <>, <>---string to double or float INDEX strtod INDEX _strtod_r INDEX - strtodf + strtof ANSI_SYNOPSIS #include 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]>, const char *<[str]>, char **<[tail]>); @@ -23,7 +23,7 @@ TRAD_SYNOPSIS char *<[str]>; char **<[tail]>; - float strtodf(<[str]>,<[tail]>) + float strtof(<[str]>,<[tail]>) char *<[str]>; char **<[tail]>; @@ -48,7 +48,7 @@ DESCRIPTION (which will contain at least the terminating null character of <[str]>) is stored in <<*<[tail]>>>. If you want no assignment to <<*<[tail]>>>, pass a null pointer as <[tail]>. - <> is identical to <> except for its return type. + <> is identical to <> except for its return type. This implementation returns the nearest machine number to the input decimal string. Ties are broken by using the IEEE @@ -721,11 +721,11 @@ _DEFUN (strtod, (s00, se), } float -_DEFUN (strtodf, (s00, se), +_DEFUN (strtof, (s00, se), _CONST char *s00 _AND char **se) { - return _strtod_r (_REENT, s00, se); + return (float)_strtod_r (_REENT, s00, se); } #endif -- cgit v1.1