Re: Bug in numeric_power() if exponent is INT_MIN

2021-01-04 Thread Tom Lane
Dean Rasheed writes: > The issue is in this line from power_var_int(): > sig_digits += (int) log(Abs(exp)) + 8; > because "exp" is a signed int, so Abs(exp) leaves INT_MIN unchanged. > The most straightforward fix is to use fabs() instead, so that "exp" > is cast to double *before* the absolut

Bug in numeric_power() if exponent is INT_MIN

2021-01-04 Thread Dean Rasheed
(Amusingly I only found this after discovering that Windows Calculator has a similar bug which causes it to crash if you try to raise a number to the power INT_MIN.) On my machine, numeric_power() loses all precision if the exponent is INT_MIN, though the actual failure mode might well be platform