X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com 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 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= From: Achim Gratz To: cygwin AT cygwin DOT 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 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 AT cygwin DOT 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple