Namespaces
Variants
Views
Actions

Talk:c/numeric/math

From cppreference.com

Contents

[edit] INFINITY (c99) and NAN (c99) missing?

The following code works in mingw 4.8.1 compiling main.c:

#include <stdio.h>
#include <math.h>
 
int main() {
    printf("%f, %f", INFINITY, NAN);
    return 0;
}

Possible output:

1.#INF00, 1.#QNAN0

On page http://en.cppreference.com/w/cpp/numeric/math INFINITY (c++11) and NAN (c++11) appear, but http://en.cppreference.com/w/c/numeric/math not appear INFINITY (c99) and NAN (c99). --Diego91b (talk) 16:37, 20 May 2014 (PDT)

Yes they are missing. The C reference wiki is lagging behind the C++ reference in completeness. Don't be afraid to create those pages. --Cubbi (talk) 18:12, 20 May 2014 (PDT)

[edit] Moving to c/numeric/math

Perhaps it's worth to move this page and all subpages to c/numeric/math/*? C has at least four numerics-related "modules" (mathematical functions, random number generation functions, type generic macros and floating point environment), so I think it would be a good idea to place them under a single category, as is done in the C++ side of the wiki. -- P12 10:15, 16 April 2012 (PDT)

[edit] Consistency among entries

In the second column, some entries begin with the verbs "computes" or "returns" while others begin with neither. I propose selecting one option and applying to all entries - for consistency. I favor beginning each entry with neither verb, like the entry "area hyperbolic sine". Newatthis (talk) 07:52, 22 May 2014 (PDT)

The wording seems to follow the ISO standard usage, at least in part ("The sqrt functions compute the nonnegative square root of x" but "The exp functions return ex
") - but then of course then this wiki deviates, e.g. it lists erf/erfl/erfl as "error function" in its dsc entry. I have no objections to choosing one approach if there's one that fits all (how do you describe scalbn in the verb-less approach? "The scalbn function"?). Speaking of changing dsc entries, I would like to see all functions shown (three in most cases), not just the one that takes the double argument. --Cubbi (talk) 08:35, 22 May 2014 (PDT)
In the "Description" sections of chapter 7.12 of n1570, I see several verbs used: compute, return, determine, classify, extract, break, round, differ, produce. Whoo! "Compute" is by far the most used. I suppose using the verb found in the description for each math function in n1570 would hew this page closer to the usage of the ISO standard, but the verb seems so extraneous for most entries on this page. Several current entries already lack a verb: tanh, asinh; some entries could lack a verb without harm: sinh, cosh. That inconsistency prompted my verb-less idea. Regarding scalbn, I thought, "number times FLT_RADIX raised to a power". Yes, I am applying the shoe horn with that one, but it seems to work. The predicates, like isnan(), are a challenge. Maybe my verb-less idea is really a near verb-less idea, ie drop the verb where possible and keep it where needed. Regarding the dsc entries, I am seeking how to learn to change them to show the float and long double names as well. Newatthis (talk) 10:24, 22 May 2014 (PDT)
Descriptions without verbs read like descriptions of variables or constants of some kind, not functions. Given that the new style would deviate from the rest of the wiki, I think that we could fix the lack of consistency by adding proper verbs where missing instead. "Computes" could fit all the entries where we can't use more specific computation verbs such as "adds", "raises", "multiplies", etc. --P12 13:13, 22 May 2014 (PDT)
OK, so action entries, rather verb-less titles, it is then. I see that dsc templates are secured. Perhaps an owner of cppreference can insert the verbs in the templates. Newatthis (talk) 04:04, 24 May 2014 (PDT)
Which ones? They shouldn't be protected. E.g. this can be edited without restrictions. The rest should be similar. Only the core dsc templates, that control the presentation of content passed via their parameters, are protected.
BTW, you may find 'show edit links' plugin useful. Go to your preferences -> gadgets and enable "show edit links" gadget. This will cause an edit link near each dsc template to be shown, which makes editing those small templates much easier. --P12 18:49, 24 May 2014 (PDT)
Thanks. I edited one entry, fabs. If this entry now has what is desired, I'll proceed with the other entries. I'll draw suitable verbs from n1570. Newatthis (talk) 04:40, 28 May 2014 (PDT)
How do I access the nan template? I tried "http://en.cppreference.com/w/Template:c/numeric/math/dsc_nan". I would like to insert a verb.
How do I access the templates for float_t, double_t, etc. I would like to insert "C99" where appropriate. Newatthis (talk) 04:45, 30 May 2014 (PDT)

[edit] Missing "(C99)" in entries float_t, double_t, div_t, ...

The templates of these entries include the text "notes=(C99)", yet "(C99)" does not appear in the entries of the Type section. What might be preventing the appearance?

Which templates are you referring to? The information in the "Types" section on this page looks like it's directly specified, as opposed to being included via templates. --Nate (talk) 08:29, 3 June 2014 (PDT)
Types section. Newatthis (talk) 07:17, 8 June 2014 (PDT)
Edits completed. "C99" now appears in four of the six entries of the Types subsection. Newatthis (talk) 05:24, 9 June 2014 (PDT)