[Cfp-interest] (SC22WG14.14885) Comparison macros and usual arithmetic conversions

Jim Thomas jaswthomas at sbcglobal.net
Mon Nov 13 21:20:57 PST 2017


Here’s a suggested fix for the problem Joseph identifies in the email below.

In Part 3 clause 12, after the second paragraph, insert:
Changes to C11 + TS18661-1 + TS18661-2:

To 7.12.14#1, append:

	If neither of the sets of values of the argument formats is a subset of (or equivalent to) the other, the behavior is undefined. 

   
> On Nov 8, 2017, at 6:11 AM, Joseph Myers <joseph at codesourcery.com> wrote:
> 
> The usual arithmetic conversions in TS 18661-3 include "If both operands 
> have floating types and neither of the sets of values of their 
> corresponding real types is a subset of (or equivalent to) the other, the 
> behavior is undefined.".
> 
> Thus, for example, if neither of long double and _Float128 has a set of 
> values that is a subset of the other, given
> 
> long double a;
> _Float128 b;
> 
> it's undefined to have the expression "a < b".
> 
> Now what about the expression "isless (a, b)"?  By analogy with the direct 
> comparison, it would seem natural for it to be undefined.  But while 
> 18661-2 explicitly disallows using those macros with one decimal and one 
> non-decimal argument,

> I see nothing to disallow the case where neither set 
> of values is a subset of the other, and the definition of these macros 
> doesn't actually include the usual arithmetic conversions.
> 
> -- 
> Joseph S. Myers
> joseph at codesourcery.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20171113/db8204fa/attachment-0001.html 


More information about the Cfp-interest mailing list