Namespaces
Variants
Actions

Talk:c/numeric/tgmath

From cppreference.com

[edit] What's meant by incompatible?

This question appears twice on this page. I wish to try to answer it to remove the box, but I want to be sure that I understand it. Does the call ceil(5.0F+5.0F*I) contain an argument that is incompatible with function ceil(), since ceil has no complex counterpart? No matter what complex value I submit to ceil, the result is 0.0. Is this call a suitable answer to the question? Newatthis (talk) 05:26, 30 May 2014 (PDT)

the todo is a request for clarification for the C11's footnote 314 in 7.25p1 aka C99's footnote 273 in 7.22p2. Compatible types are defined in 6.2.7 (C99 and C11) and in many individual sentences of 6.7. Calling ceil(5.0F+5.0F*I) will invoke undefined behavior because of normative standard requirement (not a note) at the bottom of 7.25p5 (C11) aka 7.22p5 in C99, but even without it, the parameter type of the selected function (float) is not compatible with the argument type (float complex (or double complex, depending on FLT_EVAL_METHOD). It is convertible, but not compatible. However, it is possible that the footnotr meant convertible, since integer arguments are accepted by tgmath through double parameters.. so the request for clarification is valid in my opinion. --Cubbi (talk) 07:05, 30 May 2014 (PDT)

[edit] abs or fabs?

The first column of the first table lists "abs" as the type-generic name for fabs and cabs. Yet, 7.25(4) lists fabs as the type-generic name. Also putting the following statement

            printf("%zu\n", sizeof(abs(1)) );

in the example yields a compiler error, not 8. Is this table entry incorrect? Newatthis (talk) 05:02, 31 May 2014 (PDT)

Hm, yeah. The standard pretty clearly says " The corresponding type-generic macro for fabs and cabs is fabs." That, at least, should be fixed here. --Nate (talk) 09:12, 3 June 2014 (PDT)
fixed here. fabs page already had it right. --Cubbi (talk) 09:30, 3 June 2014 (PDT)


[edit] fabs exception / table?

It says "An exception to the above rule is the fabs macro (see the table below)". But I don't see an exception for fabs anywhere.

the table below shows how fabs is special (it loses the f) --Cubbi (talk) 19:44, 28 November 2018 (PST)