Question

If we look to the draft of C11, the following names were reserved :

7.31 Future library directions
The following names are grouped under individual headers for convenience. All external
names described below are reserved no matter what headers are included by the program.
7.31.1 Complex arithmetic <complex.h>
The function names
cerf cerfc cexp2 cexpm1 clog10 clog1p clog2 clgamma ctgamma
and the same names suffixed with f or l may be added to the declarations in the
<complex.h> header.

As I would like very much to see the complex gamma functions as a part of standard C (because they are a basis for a lot of other complex functions), I wonder what is the real signification of the 7.31.1 clause.

Why only add declarations and not their definitions ?

Can we expect them for the next C standard or for a minor release ? (and if the answer is yes, when the next standard is expected ?)

Is there any implementations already available as non-standard extensions of compilers ?

Was it helpful?

Solution

A couple of months ago, I have published a library libcerf that provides the missing functions cerf and cerfc, based on numerical code by Steven G. Johnson. Our implementation is accurate to 13-14 digits, which is good enough for almost every practical use - but in achieving this, one understands how much more work needs to be done to write an acceptable standard: it is not likely that this will be undertaken by anybody any soon.

So concerning your question about clgamma and ctgamma: don't wait for the standard. Search for code that just works. Ideally, wrap this code and provide a library like libcerf that is almost as good as a standard implementation.

OTHER TIPS

The glibc maintainers almost never want to add new functions that aren't standardized in any way, and cerf is NOT part of the C99 standard --- it is merely reserved for possible future use, which makes it especially unlikely that glibc will accept an implementation until the required behavior of the function has been standardized.

It sure would be nice though, if it were incorporated, to be just like "erf()" in the C++ code, but instead "cerf()".

As per manual :

cerf[f|l]C99 An optional complex error function that, if provided, must be declared in complex.h.

As per above statement, the functions will be declared only if provided.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top