Re: PRINTF(3) Miswriting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rohit!

* Rohit Saily <rohit@xxxxxxxxxxxxxx>, 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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux