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

Patrick Schluter Patrick.Schluter at bbox.fr
Tue Dec 17 15:43:34 UTC 2019


On Tuesday, 17 December 2019 at 14:29:58 UTC, Timon Gehr wrote:
> On 17.12.19 15:02, Patrick Schluter wrote:
>> 
>> Except for 0^^0 there is no reason to throw or crap out.
>
> 0^^0 = 1 and D gets this right already.

Not as clear cut as you say, but generally it is agreed upon 
being set to 1.

https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero

but to clarify what I meant

except for 0^0 where an exception could be justified, all other 
cases have no reason to even contemplate throwing an exception. 
It is not mathematically justified. If D was a managed language 
where integer overflows are handled by default it would be 
another story. That's why I consider that your position is the 
right one.


More information about the Digitalmars-d mailing list