...
> > pow() is part of the C standard library that is inherited by C++, with
> > modifications listed in section C.6. None of the listed modifications
> > affects this issue. In general, the only thing the C standard says about
> > pow(0,0) is that "A domain error may occur if x is zero and y is zero."
> > (7.12.7.4p2). "On a domain error, the function returns an
> > implementation-defined value; if the integer expression
> > math_errhandling & MATH_ERRNO is nonzero, the integer expression errno
> > acquires the value EDOM; if the integer expression
> > math_errhandling & MATH_ERREXCEPT is nonzero, the ‘‘invalid’’ floating-
> > point exception is raised." (7.12.1p2)
> >
> > However, an implementation that pre#defines __STDC_IEC_559__ is required
> > to also conform to the requirements of Annex F of the C standard, which
> > are derived from the requirements of ISO/IEC 60559 (== IEEE 754), which
> > includes, in particular, the requirement that "pow(x, ±0) returns 1 for
> > any x, even a NaN" (F.10.4.4). So the authors of ISO/IEC 60559
> > apparently disagree with you. Mathematically, it may be undefined, but
> > computer math can't be perfectly in accord with the math of real
> > numbers, and often isn't. I don't know how they chose that rule; one
> > possibility is that it simplifies implementation of pow().
> >
>
> There's a bit of an abuse of terminology when we call things like
> std::pow or pow "functions." In analysis x^n is a _function_.
> Exponentiation is an _operator_.
>
> The value of the _function_ is undefined at 0^0. The behavior of an
> _operator_ may be defined as you like.
The only use of "function" in the text you quoted was from the C++
standard, where the definitions of terms provided by that standard
overrule any other definitions. As a general rule, the reason why any
term is defined in the standard is that it is used there with a meaning
that might be at least subtly (and often not-so-subtly) different from
the meaning it would otherwise have. Such discrepancies are the norm,
not the exception.
C++ Functions are defined in 6.7.2p1, primarily by cross-referece to
9.2.3.5, which explains how to declare them. std::pow() is unambiguously
a C++ function (or more precisely, a family of overloaded functions,
some of them templated).
11.5p1 defines what constitutes a C++ operator; pow isn't on the list.
Still, I was curious to understand the distinction you were making.
While I've formally studied math at a fairly high level, it's been a
long time since I did so, so I reviewed the definitions (marked as
specifically for use in mathematics) provided by wikipedia:
"Formally, a function f from a set X to a set Y is defined by a set G of
ordered pairs (x, y) such that x ∈ X, y ∈ Y, and every element of X is
the first component of exactly one ordered pair in G."
<
https://en.wikipedia.org/wiki/Function_(mathematics)#Definition>
"an operator is generally a mapping that acts on elements of a space to
produce other elements of the same space."
<
https://en.wikipedia.org/wiki/Operator_(mathematics)>
Each overload of std::pow() has a set X consisting of the outer product
of the set of values represented by it's first parameter's type, and
the set of values representable by it's second parameter's type. It
maps each element of that set to one and only one element of the set Y,
consisting of all representable values of it's return type. Note that
this description applies to any particular implementation of the C/C++
standard library; different implementations might provide slightly
different mappings, due to permissible variations in the accuracy with
which they are implemented.
This seems an excellent match to the definition of a function.
However, X and Y are very different spaces, so it doesn't sound like a
particularly good match to that definition of an operator.
Possibly you're using different definitions for those terms? Nothing
would be more typical of mathematics than the use of different
definitions in different contexts - but by the same token, that should
lead you to respect C++'s decision to provide it's own, overriding
definitions for those terms.