Re: exp() versus the POSIX standard
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Darafei "Komяpa" Praliaskouski <me@komzpa.net>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-06-12T01:25:41Z
Lists: pgsql-hackers
=?UTF-8?Q?Darafei_=22Kom=D1=8Fpa=22_Praliaskouski?= <me@komzpa.net> writes: > I've had the same issue with multiplying two tiny numbers. Select > 2e-300::float * 2e-300::float gives an underflow, and it is not a wanted > thing. This looks like handmade implementation of IEEE754's underflow > exception that should be an optional return flag in addition to well > defined number, but became a stop-the-world exception instead. Solving that problem is very far outside the scope of what I'm interested in here. I think that we'd probably regret it if we try to support IEEE subnormals, for example --- I know that all modern hardware is probably good with those, but I'd bet against different platforms' libc functions all behaving the same. I don't see a sane way to offer user control over whether we throw underflow errors or not, either. (Do you really want "+" to stop being immutable?) The darker corners of IEEE754, like inexactness exceptions, are even less likely to be implemented consistently everywhere. regards, tom lane
Commits
-
Fix behavior of exp() and power() for infinity inputs.
- decbe2bfb105 14.0 landed
-
Fix float4/8 to handle Infinity and Nan consistently, e.g. Infinity is a
- f9ac414c35ea 8.3.0 cited
-
Cleanup.
- 8fecd4febf83 7.1.1 cited