[Haskell-cafe] Comments on Haskell 2010 Report

Nick Bowler nbowler at elliptictech.com
Tue Jul 13 13:45:23 EDT 2010

On 16:21 Fri 09 Jul     , John Meacham wrote:
> I would think it is a typo in the report. Every language out there seems
> to think 0**0 is 1 and 0**y | y /= 0 is 0. I am not sure whether it is
> mandated by the IEEE standard but a quick review doesn't say they should
> be undefined (and the report mentions all the operations with undefined
> results)

IEEE 754 has three different power operations.  They are "recommended"
operations, which means that supporting them is optional.

pown only allows integral exponents, and the standard says the following:

    pown (x, 0) is 1 for any x (even a zero, quiet NaN, or infinity)

pow handles integral exponents as a special case, and is similar:

    pow (x, ±0) is 1 for any x (even a zero, quiet NaN, or infinity)

powr is defined as exp(y*log(x)).

    powr (±0, ±0) signals the invalid operation exception
    [NB: this means that the operation returns a quiet NaN].

In C, the "pow" function corresponds to the "pow" operation here,
assuming the implementation conforms to annex F of the standard (an
optional feature).

More information about the Haskell-Cafe mailing list