From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dragonfly.birch.relay.mailchannels.net (dragonfly.birch.relay.mailchannels.net [23.83.209.51]) by sourceware.org (Postfix) with ESMTPS id 333C23858D28 for ; Tue, 24 Jan 2023 21:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 333C23858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 2F08E260E61; Tue, 24 Jan 2023 21:32:38 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8E666260B0B; Tue, 24 Jan 2023 21:32:37 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1674595957; a=rsa-sha256; cv=none; b=nPJ8Za4qLb3ZaTHijoaylhjahubYru/eMcBIgyXFtvYV0ZFPrik32jmSSxcUl3uec0xZOl BS3gaiTk6kvcm74usBA+uovSlVvAhv4AL9nSO1TXUH3vjBrTOaiaLUBpVPYmqD+DEFvZYr R8O0HZP1iNGzzAjZH2Qre3USjiEyTvYOOaryyk1T8lzwHEut8+d+Lo1yUfyCt+LebGZ8rW 2xZE/PGm1NS58gXWcNVOvReVHglSfAEYnOyl1dxDUFm6pEWf3bJ2SqWfeqfvOZyeLwV4O7 6v3fx6dyc2csh85rO429sdY9i3d/It4lyVlF96u7HQ6bJqLOdpeoasjThL8yFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674595957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AWpSLDcY7AMf6YyBTx4goVMIGJfX0osDo+5mT09LKpA=; b=5WohKQP/1I9sf34tuuMiP/Ds/KdiZTvmHAeQTWzxkWVtmY9qrV27xMTLM9b0LJdH819qC8 t/W1IYwhG6U6zXCg61x1f24d/9zYJQ0IZ4frHyRO5HdZBmrsPyGruwRDVswjEJKUZnnunH rXfCFq7LIhOvxM0ZNPtrvD9iqTcLy213+jIBn1/aGTg+XNEai5K6lV+s1JYkhsI6cssB+H gqTANsjSp8pXNQ9DRQbQPR86+x3d04POuA3/vzYb18juD07QANQ0NYVB/cYibXmcxQyMKL zoRirut62Nr+tpX2aFXecpKPkhBuS+EwsmK3dI+alojM9grUKQkYFhQhLXxyKg== ARC-Authentication-Results: i=1; rspamd-69c95c757c-x498r; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Thread-Wipe: 76d5c4b3568b4bff_1674595957939_1640595107 X-MC-Loop-Signature: 1674595957939:3191175380 X-MC-Ingress-Time: 1674595957939 Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.107.134.91 (trex/6.7.1); Tue, 24 Jan 2023 21:32:37 +0000 Received: from [192.168.0.182] (bras-base-toroon4834w-grc-23-76-68-24-147.dsl.bell.ca [76.68.24.147]) (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: siddhesh@gotplt.org) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4P1gDM733LzDB; Tue, 24 Jan 2023 13:32:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1674595956; bh=AWpSLDcY7AMf6YyBTx4goVMIGJfX0osDo+5mT09LKpA=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=kwQ35au9+2FbqYyyvmJtgC4jkOpjgEbiFlJ7nXvzHKafBZLeCQ9gCAYkGnF7uJJdH s/yn9nXRzhdFA7Amq8tfI7JF1oRsKyJNFVwqvnecf1RL4awfeA0onOdRhiEdmubC9D grtioZNkXR2xlzR29/USZYzJlfpq7KKzGVqPROMnqcQSFJ69k8RTjAZfOjyzqKHFh6 zqR6HOyldItdXrAOhwpy0XaN9wFGlxK0p1cMb+ttWS8Lt+x0Ha6usCks/wYYL3Q/65 sq1Zr2cksGJM+/EaF1fmbRtALyYyUnfSbdHz6T0afmb2TGl8VKpV0Yv9LfQ/eTPtX1 SqOASGJRSJ8lA== Message-ID: Date: Tue, 24 Jan 2023 16:32:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [patch] Document '%F' format specifier Content-Language: en-US To: Paul Pluzhnikov Cc: GLIBC Devel References: <129eebb5-6a60-5ab1-9e95-6c35b61111cc@gotplt.org> From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3037.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-01-24 12:49, Paul Pluzhnikov wrote: > On Mon, Jan 23, 2023 at 8:42 AM Siddhesh Poyarekar wrote: >> >> On 2023-01-18 21:43, Paul Pluzhnikov via Libc-alpha wrote: >>> The '%F' specifier was implemented in commit 6c46718f9f0 on >>> 2000-08-23, but remains undocumented in the manual. >>> https://stackoverflow.com/questions/75157669/format-specifier-f-missing-from-glibcs-documentation >>> >>> Fix that. >>> >> >> The patch fails to apply on master. > > Sorry about that -- I've attached a revised patch. > >> Please also review other sections in stdio.texi that mention %f and add >> %F wherever applicable, e.g. input conversions. > > I think I got all the instances of '%f' updated now. > > Thanks, Just one nit, please send an update with that (see below) and I'll add a Reviewed-by. > diff --git a/manual/stdio.texi b/manual/stdio.texi > index f6319a4b8a..2aba957873 100644 > --- a/manual/stdio.texi > +++ b/manual/stdio.texi > @@ -1845,8 +1845,9 @@ Print an integer as an unsigned hexadecimal number. @samp{%x} uses > lower-case letters and @samp{%X} uses upper-case. @xref{Integer > Conversions}, for details. > > -@item @samp{%f} > +@item @samp{%f}, @samp{%F} > Print a floating-point number in normal (fixed-point) notation. > +@samp{%f} uses lower-case letters and @samp{%F} uses upper-case. > @xref{Floating-Point Conversions}, for details. > > @item @samp{%e}, @samp{%E} > @@ -2073,11 +2074,11 @@ various format options, using the template string: > @subsection Floating-Point Conversions > > This section discusses the conversion specifications for floating-point > -numbers: the @samp{%f}, @samp{%e}, @samp{%E}, @samp{%g}, and @samp{%G} > -conversions. > +numbers: the @samp{%f}, @samp{%F}, @samp{%e}, @samp{%E}, @samp{%g}, and > +@samp{%G} conversions. > > -The @samp{%f} conversion prints its argument in fixed-point notation, > -producing output of the form > +The @samp{%f} and @samp{%F} conversions print their argument in fixed-point > +notation, producing output of the form > @w{[@code{-}]@var{ddd}@code{.}@var{ddd}}, > where the number of digits following the decimal point is controlled > by the precision you specify. > @@ -2093,7 +2094,7 @@ the precision. The exponent always contains at least two digits. The > The @samp{%g} and @samp{%G} conversions print the argument in the style > of @samp{%e} or @samp{%E} (respectively) if the exponent would be less > than -4 or greater than or equal to the precision; otherwise they use > -the @samp{%f} style. A precision of @code{0}, is taken as 1. > +the @samp{%f} of @same{%F} style. A precision of @code{0}, is taken as 1. or @samp{%F} > Trailing zeros are removed from the fractional portion of the result and > a decimal-point character appears only if it is followed by a digit. > > @@ -2123,7 +2124,7 @@ If the value to be printed represents infinity or a NaN, the output is > @w{[@code{-}]@code{inf}} or @code{nan} respectively if the conversion > specifier is @samp{%a}, @samp{%e}, @samp{%f}, or @samp{%g} and it is > @w{[@code{-}]@code{INF}} or @code{NAN} respectively if the conversion is > -@samp{%A}, @samp{%E}, or @samp{%G}. On some implementations, a NaN > +@samp{%A}, @samp{%E}, @samp{%F} or @samp{%G}. On some implementations, a NaN > may result in longer output with information about the payload of the > NaN; ISO C2X defines a macro @code{_PRINTF_NAN_LEN_MAX} giving the > maximum length of such output. > @@ -2162,8 +2163,8 @@ specified. > @end table > > The precision specifies how many digits follow the decimal-point > -character for the @samp{%f}, @samp{%e}, and @samp{%E} conversions. For > -these conversions, the default precision is @code{6}. If the precision > +character for the @samp{%f}, @samp{%F}, @samp{%e}, and @samp{%E} conversions. > +For these conversions, the default precision is @code{6}. If the precision > is explicitly @code{0}, this suppresses the decimal point character > entirely. For the @samp{%g} and @samp{%G} conversions, the precision > specifies how many significant digits to print. Significant digits are > @@ -3535,7 +3536,7 @@ Matches an unsigned integer written in decimal radix. > Matches an unsigned integer written in hexadecimal radix. > @xref{Numeric Input Conversions}. > > -@item @samp{%e}, @samp{%f}, @samp{%g}, @samp{%E}, @samp{%G} > +@item @samp{%e}, @samp{%f}, @samp{%g}, @samp{%E}, @samp{%F}, @samp{%G} > Matches an optionally signed floating-point number. @xref{Numeric Input > Conversions}. > > @@ -3691,7 +3692,7 @@ Specifies that the argument is a @code{size_t *}. > This modifier was introduced in @w{ISO C99}. > @end table > > -All of the @samp{%e}, @samp{%f}, @samp{%g}, @samp{%E}, and @samp{%G} > +All of the @samp{%e}, @samp{%f}, @samp{%g}, @samp{%E}, @samp{%F} and @samp{%G} > input conversions are interchangeable. They all match an optionally > signed floating point number, in the same syntax as for the > @code{strtod} function (@pxref{Parsing of Floats}).