Alexander Korotkov <aekorotkov@gmail.com> writes: > I think losing precision in the gist penalty is generally OK. Thus, > it shouldn't be a problem to round a very small value as zero.
Check.
> Probably, we could even tolerate overflow in the gist penalty.
As long as overflow -> infinity, yeah I think so. Seems like it was a mistake to insert the overflow-testing functions in this code at all, and we should simplify it down to plain C addition/subtraction/ multiplication.
The underflow should not throw an interrupting exception ever, even on plain SQL-level calculations.
The code to implement was added in error by a series of misunderstandings and gets in the way of simple things too often. I dug into the history here: