This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Dec 17 22:00, Keith Packard wrote:
> Leading zeros after the decimal point should not count
> towards the 'ndigits' limit.
>
> This makes gcvt match glibc and the posix gcvt man page.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
> newlib/libc/stdlib/ecvtbuf.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c
> index 0a5d41a0f..8936363ce 100644
> --- a/newlib/libc/stdlib/ecvtbuf.c
> +++ b/newlib/libc/stdlib/ecvtbuf.c
> @@ -349,15 +349,10 @@ _gcvt (struct _reent *ptr,
> char *end;
> char *p;
>
> - if (invalue < 1.0)
> - {
> - /* what we want is ndigits after the point */
> - p = _dtoa_r (ptr, invalue, 3, ndigit, &decpt, &sign, &end);
> - }
> - else
> - {
> - p = _dtoa_r (ptr, invalue, 2, ndigit, &decpt, &sign, &end);
> - }
> + /* We always want ndigits of precision, even if that means printing
> + * a bunch of leading zeros for numbers < 1.0
> + */
> + p = _dtoa_r (invalue, 2, ndigit, &decpt, &sign, &end);
^^^^^
same here.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Attachment:
signature.asc
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |