linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Wilk <jwilk@jwilk.net>
To: Rohit Saily <rohit@rohitsaily.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>, <linux-man@vger.kernel.org>
Subject: Re: PRINTF(3) Miswriting
Date: Mon, 18 May 2020 17:38:41 +0200	[thread overview]
Message-ID: <20200518153841.5urnrimzrqadvpvy@jwilk.net> (raw)
In-Reply-To: <CAEYDfj7TDMwUy08DiHRde6D8Qam79tALL0u=Bf2tVghKn8jeMw@mail.gmail.com>

Hi Rohit!

* Rohit Saily <rohit@rohitsaily.com>, 2020-05-16, 18:04:
>I am having difficulty understanding a sentence in the PRINTF(3) man 
>page's explanation of the 'a' and 'A' conversion specifiers, more 
>specifically it is the following sentence:
>
>>The digit before the decimal point is unspecified for nonnormalized 
>>numbers, and nonzero but other‐wise unspecified for normalized 
>>numbers.
>
>My confusion arises due to the fact that the two posible cases are 
>described with the same outcome,

I believe the wording is correct. The outcome is not always the same: 
the leading digit zero is allowed only for non-normalized numbers.

For example, printf("%a", 1.0) could produce any of these outputs:

   0x8.0p-3
   0x4.0p-2
   0x2.0p-1
   0x1.0p+0

but not:

   0x0.8p+1

On the other hand, assuming the IEEE 754 binary64 format, 
printf("%a\n", 0x0.8p-1022) could produce any of these:

   0x8.0p-1026
   0x4.0p-1025
   0x2.0p-1024
   0x1.0p-1023
   0x0.8p-1022

-- 
Jakub Wilk

  reply	other threads:[~2020-05-18 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16 22:04 PRINTF(3) Miswriting Rohit Saily
2020-05-18 15:38 ` Jakub Wilk [this message]
     [not found]   ` <CAEYDfj4TK2Maoaxudhfxkx9NJGJa4CNL30Rhud-eBUnHVpFvzw@mail.gmail.com>
2020-05-18 19:01     ` Rohit Saily

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200518153841.5urnrimzrqadvpvy@jwilk.net \
    --to=jwilk@jwilk.net \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=rohit@rohitsaily.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).