NaN - Function Definition

Function Definition

There are differences of opinion about the proper definition for the result of a numeric function that receives a quiet NaN as input. One view is that the NaN should propagate to the output of the function in all cases to propagate the indication of an error. Another view, and the one taken by the IEEE standard in general, is that if the function has multiple arguments and the output is uniquely determined by all the non-NaN inputs including infinity, then that value should be the result. Thus for example the value returned by hypot(±∞, qNaN) and hypot(qNaN, ±∞) is +∞.

The problem is particularly acute for the exponentiation function pow(x,y) = x ** y. The expressions 00, ∞0 and 1∞ are considered indeterminate forms when they occur as limits (just like ∞ × 0), and the question of whether zero to the zero power should be defined as 1 has divided opinion.

If the output is considered as undefined if a parameter is undefined then pow(1,qNaN) should produce a qNaN. However typically math libraries have returned 1 for pow(1,y) for any real number y, and even if y is infinity or -infinity. Similarly they produce 1 for pow(x,0) even when x is 0 or infinity. The rationale for returning the value 1 for the indeterminate forms was that the value of functions at singular points can be taken as a particular value if that value is in the limit the value for all but a vanishingly small part of a ball around the limit value of the parameters. The 2008 version of the IEEE 754 standard says that pow(1,qNaN) and pow(qNaN,0) should both return 1 since they return 1 whatever else is used instead of quiet NaN.

To satisfy those wishing a more strict interpretation of how the power function should act, the 2008 standard defines two additional power functions; pown(x, n) where the exponent must be an integer, and powr(x, y) which returns a NaN whenever a parameter is a NaN or the exponentiation would give an indeterminate form.

Read more about this topic:  NaN

Other articles related to "functions, function, function definition":

Vienna Development Method - Modelling Functionality - Functional Modelling
... In VDM-SL, functions are defined over the data types defined in a model ... it should be possible to characterize the result that a function should compute without having to say how it should be computed ... The main mechanism for doing this is the implicit function definition in which, instead of a formula computing a result, a logical predicate over the input and result variables, termed a postcondition, gives the ...
Cadence SKILL - Syntax - Function Definition
... For example, the factorial function in SKILL may be represented several different ways which are all compiled to the identical internal representation ...

Famous quotes containing the words definition and/or function:

    It’s a rare parent who can see his or her child clearly and objectively. At a school board meeting I attended . . . the only definition of a gifted child on which everyone in the audience could agree was “mine.”
    Jane Adams (20th century)

    Literature does not exist in a vacuum. Writers as such have a definite social function exactly proportional to their ability as writers. This is their main use.
    Ezra Pound (1885–1972)