Re: PRINTF(3) Miswriting

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

 



Hi Jakub,


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

If I am understanding this correctly, shouldn't the man page say:

"The digit before the decimal point is specified for nonnormalized
numbers, and nonzero numbers but other‐wise unspecified for normalized
numbers."

I replaced the first occurence of "unspecified" with "specified" and
inserted "numbers"
after "nonzero". To make it even simpler:

"The digit before the decimal point is unspecified when the number is
normalized and the digit is zero; otherwise, the digit is specified."

Is this correct?

Also, why is it possible that the following numbers are printed if
the floating-point number is 1.0?

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

Why are there multiple possibilities if the IEEE 754 standard is being
used? I did not know that was a possibility.


Thank you for your time,

Rohit Saily


On Mon, May 18, 2020 at 2:49 PM Rohit Saily <rohit@xxxxxxxxxxxxxx> wrote:
>
> Hi Jakub,
>
>
> > I believe the wording is correct. The outcome is not always the same:
> > the leading digit zero is allowed only for non-normalized numbers.
>
> If I am understanding this correctly, shouldn't the man page say:
>
> The digit before the decimal point is specified for nonnormalized
> numbers, and nonzero numbers but other‐wise unspecified for normalized
> numbers.
>
> I replaced the first occurence of unspecified with specified and inserted numbers
> after nonzero. To make it even simpler:
>
> The digit before the decimal point is unspecified when the number is
> normalized and the digit is zero; otherwise, the digit is specified.
>
> Is this correct?
>
> Also, why is it possible that the following numbers are printed if
> the floating-point number is 1.0?
>
> 0x8.0p-3
> 0x4.0p-2
> 0x2.0p-1
>
> Why are there multiple possibilities if the IEEE 754 standard is being
> used? I did not know that was a possibility.
>
>
> Thank you for your time,
>
> Rohit Saily
>
>
> On Mon, May 18, 2020 at 11:38 AM Jakub Wilk <jwilk@xxxxxxxxx> wrote:
>>
>> 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