Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

781.std::complex should add missing C99 functions

Section: 29.4.7[complex.value.ops]Status:CD1Submitter: Daniel KrüglerOpened: 2008-01-26Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [complex.value.ops].

View all issues withCD1 status.

Discussion:

A comparision of the N2461 header<complex> synopsis ([complex.syn])with the C99 standard (ISO 9899, 2nd edition and the two corrigenda) showsome complex functions that are missing in C++. These are:

  1. 7.3.9.4: (required elements of the C99 library)
    Thecproj functions
  2. 7.26.1: (optional elements of the C99 library)
    cerf    cerfc    cexp2cexpm1  clog10   clog1pclog2   clgamma  ctgamma

I propose that at least the requiredcproj overloads are provided as equivalentC++ functions. This addition is easy to do in one sentence (delegation to C99function).

Please note also that the current entrypolarin 29.4.10[cmplx.over] p. 1should be removed from the mentioned overload list. It does not make sense to require that afunction already expectingscalar argumentsshould cast these arguments into correspondingcomplex<T> arguments, which are not accepted bythis function.

Proposed resolution:

In 29.4.2[complex.syn] add just between the declaration ofconj andfabs:

template<class T> complex<T> conj(const complex<T>&);template<class T> complex<T> proj(const complex<T>&);template<class T> complex<T> fabs(const complex<T>&);

In 29.4.7[complex.value.ops] just after p.6 (return clause ofconj) add:

template<class T> complex<T> proj(const complex<T>& x);

Effects: Behaves the same as C99 functioncproj, defined insubclause 7.3.9.4."

In 29.4.10[cmplx.over] p. 1, add one further entryproj tothe overload list.

The following function templates shall have additional overloads:

arg           norm conjpolarprojimag          real

[8]ページ先頭

©2009-2026 Movatter.jp