From patchwork Wed Jan 25 01:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 63652 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B01F3858C60 for ; Wed, 25 Jan 2023 01:04:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B01F3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674608685; bh=CqX16EolB/ACLK+qR47vYhAw/62QHjkjut51TbBfI2w=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=rHsn6ev10VInGkmUz04YTI5j6BlbG3RD13ArjNDH2TJXBqSI54+ZB+sW+TU0zgSkv QvPnVfGhNA/dV2vp6SgUhi+y62ognVR5u9fi4rtpIJTz9bxnK35nxPLsovufXG71Pq wmTsTuj/mShvyaRy0vRz4KtmJDc/rA1+ur4j+9T0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by sourceware.org (Postfix) with ESMTPS id 11B6C3858D33 for ; Wed, 25 Jan 2023 01:04:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11B6C3858D33 Received: by mail-pf1-x44a.google.com with SMTP id v23-20020aa78097000000b005748c087db1so7404399pff.2 for ; Tue, 24 Jan 2023 17:04:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CqX16EolB/ACLK+qR47vYhAw/62QHjkjut51TbBfI2w=; b=KsBgmJmMPTQCbDWimDT4PZ2OBEznEuvpN+8t0zWjG0Xq1LqkUDe0m5Kf1/XD7evInp oi5SAG/N4fP55Mlc32W/r/WwhKO4/ZXf+QlCtdDEy+vB9xIp3RVqonEi2tP+qA/tdmxV L1ZPNxhXiTE5LzaQMa8RiEwC8g9wyp6KgPmd8db+2ugmaHZcpTylAxkYaKUWOwwxKw2r OWP27VNiToxFL/0VI1lnoqv3zG0M5qNhE7nAymk4Z0sp2mZTybACFJSuVx+vVHP4j7oR z28QB5PI7bAn9o86CFgxnALLtsAVjUJRA7pgAJa3GSdMKiQD3Gl/fLya0qf4cqlstUS/ jZfA== X-Gm-Message-State: AFqh2koLxDQt5rcm6YmA+afEl3IfjwFtJ8SwCiDk4qGLYowsQL5wr0/u SFLOhRFfq4LzJATRGXh0ppLth9ObnDqn9qNDjJfqZ0u981U32tD7LmyUfVqpU9xxu4CkUfZpTjy LIp+iFzVp5q0Gh5knpNGcJIyij72NHIj6KnBS/r/oKS78sLjXPfCvHUOnmI1tzS7dsYH+cWK8HW 3GmGk= X-Google-Smtp-Source: AMrXdXsbtT+BUmyb2cUL0FRPFNtYHFij9BLYNEtfQ5/RK+SntnkVmkeoh0BUL6kdyCira4KGuY6lP1io6hFLz4rHpA== X-Received: from elbrus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:12e9]) (user=ppluzhnikov job=sendgmr) by 2002:a17:90b:507:b0:226:ce49:3df6 with SMTP id r7-20020a17090b050700b00226ce493df6mr3063983pjz.61.1674608651913; Tue, 24 Jan 2023 17:04:11 -0800 (PST) Date: Wed, 25 Jan 2023 01:03:08 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.1.405.gd4c25cc71f-goog Message-ID: <20230125010307.954443-1-ppluzhnikov@google.com> Subject: [committed][PATCH] Document '%F' format specifier To: libc-alpha@sourceware.org Cc: Paul Pluzhnikov , Siddhesh Poyarekar X-Spam-Status: No, score=-19.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Pluzhnikov via Libc-alpha From: Paul Pluzhnikov Reply-To: Paul Pluzhnikov Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The '%F' format 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. Reviewed-by: Siddhesh Poyarekar --- manual/stdio.texi | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/manual/stdio.texi b/manual/stdio.texi index f6319a4b8a..d7eab1843a 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} or @samp{%F} style. A precision of @code{0}, is taken as 1. 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}).