From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: Re: exp() versus the POSIX standard
Date: Thu, 11 Jun 2020 19:56:49 -0400
Message-ID: <583847.1591919809@sss.pgh.pa.us> (raw)
In-Reply-To: <582552.1591917752@sss.pgh.pa.us>
References: <582552.1591917752@sss.pgh.pa.us>
I wrote:
> The POSIX standard says this about the exp(3) function:
> If x is -Inf, +0 shall be returned.
> At least on my Linux box, our version does no such thing:
> regression=# select exp('-inf'::float8);
> ERROR: value out of range: underflow
Now that I look, power() has similar issues:
regression=# select power('1.1'::float8, '-inf');
ERROR: value out of range: underflow
regression=# select power('0.1'::float8, 'inf');
ERROR: value out of range: underflow
regression=# select power('-inf'::float8, '-3');
ERROR: value out of range: underflow
regression=# select power('-inf'::float8, '-4');
ERROR: value out of range: underflow
contradicting POSIX which says
For |x| > 1, if y is -Inf, +0 shall be returned.
For |x| < 1, if y is +Inf, +0 shall be returned.
For y an odd integer < 0, if x is -Inf, -0 shall be returned.
For y < 0 and not an odd integer, if x is -Inf, +0 shall be returned.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
Subject: Re: exp() versus the POSIX standard
In-Reply-To: <583847.1591919809@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox