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

René Heldmaier rene.heldmaier at
Wed Dec 18 08:23:58 UTC 2019

On Tuesday, 17 December 2019 at 12:40:10 UTC, Timon Gehr wrote:
> On 16.12.19 13:25, Johannes Loher wrote:
>> I admit that Timon’s explanations sounded a bit harsh
> I reported an obvious issue. It's really a no-brainer, but some 
> people somehow feel the need to intervene and argue in favour 
> of the trivially wrong behavior (this is an issue of basic 
> arithmetic), calling my precious code nonsensical or trying to 
> argue that I must not be aware that built-in integer types have 
> finite precision, etc.


It's integer arithmetic, so it should just return 0 if the 
mathematically correct result would be less than 1.

A short example:
int a = 5;
int b = 25;
int c = a / b;
Should this throw an exception or cause a divide by zero error?
If not, why should the "^^" operator behave different?

More information about the Digitalmars-d mailing list