From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30313 invoked by alias); 18 Dec 2019 16:49:15 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 30282 invoked by uid 89); 18 Dec 2019 16:49:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: elaine.keithp.com Received: from home.keithp.com (HELO elaine.keithp.com) (63.227.221.253) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 16:49:14 +0000 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id B04473F2A0A3 for ; Wed, 18 Dec 2019 08:49:12 -0800 (PST) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sLcVx8oSPnX5; Wed, 18 Dec 2019 08:49:12 -0800 (PST) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 518993F2A09F; Wed, 18 Dec 2019 08:49:12 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 3E6861582169; Wed, 18 Dec 2019 08:49:12 -0800 (PST) From: Keith Packard To: newlib@sourceware.org Cc: Keith Packard Subject: [PATCH 1/2] Fix fcvt to only show 'ndigit' past decimal Date: Wed, 18 Dec 2019 16:49:00 -0000 Message-Id: <20191218164906.1124916-1-keithp@keithp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019/txt/msg00677.txt.bz2 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 --- 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..12e8c9a92 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 (reent, invalue, 3, ndigit, decpt, sign, &end); /* Now copy */ -- 2.24.0