On Wed, 16 Mar 2016 01:53:59 -0600 Scott Robison <scott at casaderobison.com> wrote:
> > For example, even the operation "select cast(pow(2,65) as integer)" > > and > "select cast(-pow(2,65) as integer)" should return NULL rather than > MAXINT and MININT respectively. > > The $64 bit question ;) is how much existing code might break if such > changes were made. One can argue that the existing implementation is > broken, but a lot of software has been written to use it as it is. > What happens to them if such an improvement is made? Doubtless there is code out there that relies on division by zero producing NULL. I personally would like to see a pragma MATH=ON to change that. Many of the outputs the OP has enumerated are considered undefined behavior. Any computation relying on them would produce incorrect results. Changing that to NULL, as Keith recommends, would arguably make them "correct", and wouldn't violate the promise not to change *defined* behavior. IMO the user would be better served by raising an error, so that it can be dealt with at its source. --jkl