From 67994d6f6010739c22b1b4ab99aa88b4fe1ab8bd Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 23 Jun 1999 12:38:51 +0000 Subject: Update. 1999-06-23 Ulrich Drepper * manual/arith.texi: Document restriction of ndigit parameter of ecvt and friends. * misc/efgcvt.c: Define NDIGIT_MAX. (gcvt): Limit precision in sprintf call to NDIGIT_MAX. Do not dynamically allocate the static buffers. They are small enough. * misc/efgcvt_r.c: Define NDIGIT_MAX. (fcvt_r): Limit precision in snprintf call to NDIGIT_MAX. * misc/qefgcvt.c: Define NDIGIT_MAX. * misc/qefgcvt_r.c: Likewise. * misc/tst-efgcvt.c (special): Add test for large ndigit parameter. --- manual/arith.texi | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'manual/arith.texi') diff --git a/manual/arith.texi b/manual/arith.texi index a42267712d..7879a77b7c 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -2199,6 +2199,9 @@ index in the string of the first digit after the decimal point. @var{neg} is set to a nonzero value if @var{value} is negative, zero otherwise. +If @var{ndigit} decimal digits would exceed the precision of a +@code{double} it is reduced to a system-specific value. + The returned string is statically allocated and overwritten by each call to @code{ecvt}. @@ -2220,6 +2223,9 @@ left of the decimal point. For example, if @var{ndigit} is @code{-1}, negative and larger than the number of digits to the left of the decimal point in @var{value}, @var{value} will be rounded to one significant digit. +If @var{ndigit} decimal digits would exceed the precision of a +@code{double} it is reduced to a system-specific value. + The returned string is statically allocated and overwritten by each call to @code{fcvt}. @end deftypefun @@ -2230,6 +2236,9 @@ to @code{fcvt}. @code{gcvt} is functionally equivalent to @samp{sprintf(buf, "%*g", ndigit, value}. It is provided only for compatibility's sake. It returns @var{buf}. + +If @var{ndigit} decimal digits would exceed the precision of a +@code{double} it is reduced to a system-specific value. @end deftypefun As extensions, the GNU C library provides versions of these three @@ -2238,22 +2247,25 @@ functions that take @code{long double} arguments. @comment stdlib.h @comment GNU @deftypefun {char *} qecvt (long double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{neg}) -This function is equivalent to @code{ecvt} except that it -takes a @code{long double} for the first parameter. +This function is equivalent to @code{ecvt} except that it takes a +@code{long double} for the first parameter and that @var{ndigit} is +restricted by the precision of a @code{long double}. @end deftypefun @comment stdlib.h @comment GNU @deftypefun {char *} qfcvt (long double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{neg}) This function is equivalent to @code{fcvt} except that it -takes a @code{long double} for the first parameter. +takes a @code{long double} for the first parameter and that @var{ndigit} is +restricted by the precision of a @code{long double}. @end deftypefun @comment stdlib.h @comment GNU @deftypefun {char *} qgcvt (long double @var{value}, int @var{ndigit}, char *@var{buf}) -This function is equivalent to @code{gcvt} except that it -takes a @code{long double} for the first parameter. +This function is equivalent to @code{gcvt} except that it takes a +@code{long double} for the first parameter and that @var{ndigit} is +restricted by the precision of a @code{long double}. @end deftypefun -- cgit v1.2.3