[cfp-interest 3906] Re: Trailing Decimal Exponent on a Hexadecimal standard floating type

Damian McGuckin damianm at esi.com.au
Mon Apr 20 23:07:15 PDT 2026


Paul,

On Tue, 21 Apr 2026, Paul Zimmermann wrote:

>> Why does a heximdecimal float mandate a trailing deimal exponent, e.g 
>> p+23 in something like
>>
>>  	0x1.5abp+23
>
> It is more readable by humans than 0x1.5abp+0x17.

Maybe, maybe not.

> I take the opportunity to ask whether one should standardize the way
> hexadecimal numbers are printed: 0x1.5abp+23 or 0x2.b56p+22 or
> 0x5.6acp+21 or 0xa.d58p+20. I prefer 0x1.5abp+23 since the magnitude
> is easier to guess.

Good point. Not sure I have the perfect answer.

> Rationale: different libraries use different conventions, which makes
> it difficult to compare results.

Yes.  I would be tempted to do the last but you obviously prefer the 
latter. Must have something to do with me being south of the equator

> There is also the issue of subnormal numbers. Some libraries print
> them as say 0x0.000000000001p-1074, which is a good way to see it
> is a subnormal.

I think you mean they get printed as

 	0x0.000000000001p-1022

not

 	0x1.0p-1074

The number you are trying to print is only representable in a long double.

Thanks - Damian


More information about the cfp-interest mailing list