From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpout2.vodafonemail.de (smtpout2.vodafonemail.de [145.253.239.133]) by sourceware.org (Postfix) with ESMTPS id BD514385701E for ; Sun, 13 Jun 2021 09:42:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD514385701E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nexgo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nexgo.de Received: from smtp.vodafone.de (smtpa07.fra-mediabeam.com [10.2.0.38]) by smtpout2.vodafonemail.de (Postfix) with ESMTP id 721E012260A for ; Sun, 13 Jun 2021 11:42:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1623577363; bh=skvxqAKX1mwMab0yu6sBlEXcbvHTSshvSmTZDrwJQaU=; h=From:To:Subject:References:Date:In-Reply-To; b=oVBN+4fj0AT2dnDZwed+MZcjIRWY2ihCuMBF99oDrqYyVs8I7EJbKy16jiD60uf7n +mDXt5iJlfyHy7kUjUF8G8q6fcrVz/d7iPcFSQvmqDwRkBpTINsb+IZKpGjkjZkDCt 2h2pjb4PXcxOBe0loNBDoRVJqfKVgu5MblNIewyc= Received: from Gertrud (p54a0c8c7.dip0.t-ipconnect.de [84.160.200.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 25CF9140178 for ; Sun, 13 Jun 2021 09:42:43 +0000 (UTC) From: Achim Gratz To: cygwin@cygwin.com Subject: Re: gcc 11.1.0: printf("%.43f\n", 0x1.52f8a8e32e982p-140): printed value is incorrectly rounded References: Date: Sun, 13 Jun 2021 11:42:38 +0200 In-Reply-To: (Pavel M. via Cygwin's message of "Sat, 12 Jun 2021 23:45:54 +0300") Message-ID: <87o8caumlt.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 973 X-purgate-ID: 155817::1623577363-0000067D-983C908F/0/0 X-Spam-Status: No, score=-3032.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2021 09:42:47 -0000 Pavel M via Cygwin writes: > Sample code (t903.c): > #include > int main(void) > { > printf("%.43f\n", 0x1.52f8a8e32e982p-140); > return 0; > } > > Invocations: > # gcc on Windows 10 (Cygwin) > $ gcc t903.c -Wall -Wextra -std=c11 -pedantic -Wfatal-errors && ./a.exe > 0.0000000000000000000000000000000000000000010 You will want to report this against newlib, I'd think. If I remember correctly, newlib uses a single guard digit for the conversion and for such an algorithm the result you see is expected and correct. Whether any later C standard would mandate to use an algorithm that uses higher precision (in terms of guard digits you'd end up with 15 for your example before you get the expected result I think) I have no idea. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada