[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Suggestion of annex D
On 2007-05-29 23:32:57 +1000, Peter Henderson wrote:
They also do not work if f(x) tends to zero from both above and
below, then +0 is preferable, due to the bias mentioned above, but
again the choice is not really important.
The choice could depend on the rounding mode.
In cases where f(0) is not a finite c, infinity arithmetic rules apply,
i.e. +0 is considered as a infinitesimally small positive number, -0 as a
infinitesimally small negative number. (cf. our proposal for section 7.1
of the draft)
This view of +0 and -0 cannot be made to work. The philosophy of the
standard is that a number represents itself.
Except when considering limits. Think about 0 * inf...
* log(eps) -> +infty for eps -> 0, eps > 0 => log(+0) = -infty
^^^^^^ -infty
Actually, log(eps) is finite for any finite floating point number > 0.
Well, in practice only.
log(+0)= -infty, as this is the limit as x tends to zero.
This is what is considered above.
* log(eps) undefined for eps < 0, even infinitesimal => log(-0) = NaN
In a similar manner, sqrt(-0) = NaN, but it isn't, it is -0.
This is not exactly the same problem: 0 is a real number, but an
infinity isn't a real number. But I'd say that they should be handled
in the same way here.
I very much prefer log(-0) = -inf. I do not think many programmers
would be pleased to performn the check x>= 0 and then get hit with a
NaN.
I agree.
For infty^0, the following can be said: for a given c, take
x(t) = 2^t -> infty for t -> infty
y(t) = log2(c)/t -> 0 for t -> infty
x(t)^y(t) = 2^(y(t) * log2(x(t))) = 2^(log2(c)/t * t) = c forall t
So the principle shows that the operation pow should return NaN
As I stated, the principled view is infty^0 returns NaN. But then, so
should 0^0. For all four exceptional cases of pow(x,y), a path can be
chosen to obtain any limit in [0, infty]. For 0^0, if x(t) and y(t) both
tend to zero as t tends to zero, and both are analytic about zero and are
not identically zero, then the limit is 1. For infty^0, the same applies
if x(t) has a Laurent series about zero. The main attraction of 0^0 =1 is
it makes the rule x^0 universal. My point is that any argument for 0^0=1
applies for infty^0=1. The fact that pow(1/x,y) = 1/pow(x,y), means these
points are in a sense, mirror images of each other.
I agree. However I don't think one can give a general rule for such
particular cases.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)