From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from beige.elm.relay.mailchannels.net (beige.elm.relay.mailchannels.net [23.83.212.16]) by sourceware.org (Postfix) with ESMTPS id 136BB3857C6C for ; Thu, 4 Nov 2021 17:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 136BB3857C6C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nadler.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nadler.com X-Sender-Id: dreamhost|x-authsender|drn@nadler.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 38DB6121591; Thu, 4 Nov 2021 17:27:18 +0000 (UTC) Received: from pdx1-sub0-mail-a224.dreamhost.com (100-96-11-8.trex.outbound.svc.cluster.local [100.96.11.8]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2C0B212168B; Thu, 4 Nov 2021 17:27:17 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|drn@nadler.com Received: from pdx1-sub0-mail-a224.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.11.8 (trex/6.4.3); Thu, 04 Nov 2021 17:27:18 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|drn@nadler.com X-MailChannels-Auth-Id: dreamhost X-Battle-Trail: 5504c0f90393f16f_1636046837997_249635479 X-MC-Loop-Signature: 1636046837996:321192580 X-MC-Ingress-Time: 1636046837996 Received: from [192.168.1.3] (pool-72-74-171-157.bstnma.fios.verizon.net [72.74.171.157]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: drn@nadler.com) by pdx1-sub0-mail-a224.dreamhost.com (Postfix) with ESMTPSA id 4HlVv84JKgz2F; Thu, 4 Nov 2021 10:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=nadler.com; s=nadler.com; t=1636046836; bh=YuI1dFCaUIQ+woeAiJW6sfoPagQ=; h=Content-Type:Date:Subject:To:Cc:From; b=vCQbXlHSmM1cvAgyPwzI0AdrNm+YOJxYn4n3WPzfqd2z0GufPnbZLzq3cPdjI/Prs HYtXPCGp5dEt0jX5S93jnHPydP97mDQXel7wN+MgOyNXWWrQFLbYO1KmOzmPaVFUZy XxzGR7e8/zDIiKg8Jc2h1uHoRwODZWadEjqohS3s= Message-ID: <90598863-5b2c-30a1-ddb4-0d6d7421a835@nadler.com> Date: Thu, 4 Nov 2021 13:27:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: gcc 11.1.0: printf("%.43f\n", 0x1.52f8a8e32e982p-140): printed value is incorrectly rounded Content-Language: en-US To: Keith Packard Cc: newlib@sourceware.org References: <87ilx7vpco.fsf@keithp.com> From: Dave Nadler In-Reply-To: <87ilx7vpco.fsf@keithp.com> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, HTML_MESSAGE, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2021 17:27:22 -0000 Keith, this Ryū implementation also removes use of malloc in FP conversion right? That would solve lots of problems in the embedded world. Thanks, Best Regards, Dave On 11/4/2021 12:48 PM, Keith Packard wrote: > Corinna Vinschen writes: > >> Is anybody here willing to take a look and change Newlib to gdtoa? > It might be useful for newlib to adopt the Ryū floating point conversion > code developed by Ulf Adams (currently at Google). This does correct > double conversion in 128 bits, avoiding need for arbitrary precision > math and any allocations. > > https://dl.acm.org/doi/10.1145/3360595 > > There is a BSD licensed implementation of the core algorithm available > on github; adopting that into complete printf/scanf implementations > isn't a huge amount of work. picolibc uses this implementation. > > A friend of mine posited that this could be done, and got started on it > in grad school about 20 years ago. It was very nice to see someone > actually take the time to make it happen. -- Dave Nadler, USA East Coast voice (978) 263-0097,drn@nadler.com, Skype Dave.Nadler1