[Cfp-interest 1641] Re: C++ floating-point work

Paul Zimmermann Paul.Zimmermann at inria.fr
Tue Jun 16 01:10:11 PDT 2020


       Dear Mike,

> From: "Mike Cowlishaw" <mfc at speleotrove.com>
> Date: Mon, 15 Jun 2020 19:47:19 +0100
> 
> Hi David, thanks for posting this!   I just took a quick skim through 
> P1467R4.html ; one sentence caught my eye:
>  
>     When an implementation supports both binary and decimal floating-point,
> the conversion ranks of a binary type and a decimal type will always be
> unordered, because neither type’s set of values will be a subset of the other
> due to the different radixes. 
>  
> This is not right; binary floating-point types can always be a subset of
> appropriate decimal floating-point types because the latter have a base of
> 5*2 (in C/C++ notation), so you can make an exact conversion using the same
> number of digits.  Decimal floating-point-types, however, cannot be converted
> exactly to binary types (in general) because of that power of five.  
> 
> See http://speleotrove.com/decimal/decifaq1.html for some of the background,
> rationale, etc.

maybe the sentence was only considering numbers representable in the
corresponding format. For example 10^16+2 is representable in binary64 but
not in decimal64. For two formats of the same bit-width I guess a counting
argument can prove that you cannot have inclusion, except if the sets of
representable numbers are the same (modulo the number of encodings of NaN).

Best regards,
Paul



More information about the Cfp-interest mailing list