Re: [PATCH 1/3] Fix fcvt to only show 'ndigit' past decimal

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Keith,

On Dec 17 22:00, Keith Packard wrote:
> Even if the number is really small and this means showing *no* digits.
> This makes newlib match glibc, and the fcvt posix man page.
> 
> Signed-off-by: Keith Packard <[email protected]>
> ---
>  newlib/libc/stdlib/ecvtbuf.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c
> index e3d7b55d8..0a5d41a0f 100644
> --- a/newlib/libc/stdlib/ecvtbuf.c
> +++ b/newlib/libc/stdlib/ecvtbuf.c
> @@ -235,14 +235,7 @@ fcvtbuf (double invalue,
>  
>    save = fcvt_buf;
>  
> -  if (invalue < 1.0 && invalue > -1.0)
> -    {
> -      p = _dtoa_r (reent, invalue, 2, ndigit, decpt, sign, &end);
> -    }
> -  else
> -    {
> -      p = _dtoa_r (reent, invalue, 3, ndigit, decpt, sign, &end);
> -    }
> +  p = _dtoa_r (invalue, 3, ndigit, decpt, sign, &end);
                ^^^^^
There's a reent ptr missing in this call.  I'm puzzled that this
compiled for you.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl356RIACgkQ9TYGna5E
T6Ahww//eoFMPQXu9rM4Y4Y0J8RBP6PCQSXOAyzeDMK7m6yBoP9dmdZ2Iaw/hOEJ
rI7vwottrKAofQCHVfDuryJ7AAjg5eKMqWEjqJcux3C3OUExias9MoKUqABzSjdQ
O0aEYJ5LWBy3V5n401mcYjfXXSzFI0SD0jaEU6srNLtvS6I4ZxpxZi45NF6m7Fva
ZTCYwkOqeBGJdZxkTtQD92cfPuuZQDaCEByPR3PBg/265XfbhhDxOzl/HgU4VD5d
SmDvOrZYtoNHLk7cOryOTHfMT0WCasL/UT0bc74P786LGB9zEsm3WPqMv4nhhe4n
CgptL+W3F43W5hHxnIdKQX0J5Ecm6bZcHa3C26L1o2z95E9DvMecR9EWtNm4LiZD
faTg15NNlps9e1GE2DNGW0YfuzisH0zkov6O5EFvmuhknAcxB5194oxWlFKDVDUz
3Gnp7Wdz2G8aaLY5ObZDPBK2lXqGXdARE3fXmyD4KF3vsQwHOvvJRN6OAf9FUma2
YeB/NvDRv3gx/hxQLiE8TBrBpS7XnmWmnnHrduqElsxqmwVn5pCBK7v6CsXYU+Lq
89N7ZQHgvEYWclEvxE1s8Rqem5REwOEhrSVxu2Est7F88TUo6A9u2IMwGpr3d13F
Jl8TmIkKVHsUvX3FC3RednoPusWhibVCtiBDM9TR7jIQwWpyB+s=
=6NQY
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.