issue 7006 - std.math.pow (integral, integral) crashes on negative exponents

Timon Gehr timon.gehr at gmx.ch
Tue Dec 17 20:30:29 UTC 2019


On Tuesday, 17 December 2019 at 18:49:37 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 17 December 2019 at 16:48:42 UTC, Martin 
> Tschierschke wrote:
>> But 0^^0 in general, is very often replaced by lim x-> 0 x^^x
>
> Well, but if you do the lim of x^^y you either get 1 or 0 
> depending on how you approach it.

No, you can get any real value at all. Anything you want:

For x>0, lim[t→0⁺] (x^(-1/t))^(-t) = x.

lim[t→0⁺] 0^t = 0.

For x<0, lim[n→∞] (x^(-(2·n+1))^(-1/(2·n+1)) = x

You can also get infinity or negative infinity. pow for real 
arguments is maximally discontinuous at (0,0) (and it does not 
matter at all). The following wikipedia article, which was 
helpfully pasted earlier and you clearly did not read, clearly 
states this:
https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero

It also says that if you restrict yourself to analytic functions 
f, g: ℝ_{≥0} → ℝ with f(0)=g(0)=0 and f(x)≠0 for x in some 
neighbourhood around 0, then we actually do have lim[t→0⁺] 
f(t)^g(t) = 1. I.e., while possible, in many cases it is actually 
unlikely that your computation does not want a result of 1, even 
if you are using floating point operations. There are multiple 
functions defined in the floating-point standard that use 
different conventions, and 1 is the default, for good reason.


More information about the Digitalmars-d mailing list