[OT] ...
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 24 22:44:28 PDT 2016
On Friday, 24 June 2016 at 21:11:52 UTC, Timon Gehr wrote:
> By treating 0^0 consistently as 1, you never run into this kind
> of problem. Doesn't this demonstrate that they are doing it
> wrong? How would you design the notation?
You really need to look at the context. It is not uncommon that
solvers favour total functions where even division is defined for
"x / 0", for very pragmatic reasons. So even a total function for
power could be useful in some contexts (i.e. considered defined
not only for "0^0", but also "0^-1").
However, IEEE754-2008 is more principled. It separates pow into
power over natural numbers "pown" (where 0^0==1) and power over
inexact reals "powr". This is rather clear from the exception
thrown at "powr(1.0,inf)", as the inexact nature of a "1.0"
floating point could take it towards 0, 1 or inf.
And you cannot really know if inexact reals of "0.0^0.0" should
go towards 0.0 or 1.0. It would make most sense to return the
interval of potential values: [0,1]
More information about the Digitalmars-d
mailing list