1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Change exp() behavior to generate error on underflow rather

than silently returning zero on some machines.  Correct float8 regress test
to agree.  Also fix pow() overflow/underflow check to work correctly on
HPUX.
This commit is contained in:
Tom Lane
1998-11-29 01:57:59 +00:00
parent 67531c42bd
commit 92eacaf523
2 changed files with 5 additions and 12 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.34 1998/11/17 14:36:44 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.35 1998/11/29 01:57:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1131,7 +1131,7 @@ dpow(float64 arg1, float64 arg2)
#endif
*result = (float64data) pow(tmp1, tmp2);
#ifndef finite
if (errno == ERANGE)
if (errno != 0) /* on some machines both EDOM & ERANGE can occur */
#else
if (!finite(*result))
#endif
@ -1164,7 +1164,8 @@ dexp(float64 arg1)
#ifndef finite
if (errno == ERANGE)
#else
if (!finite(*result))
/* infinity implies overflow, zero implies underflow */
if (!finite(*result) || *result == 0.0)
#endif
elog(ERROR, "exp() result is out of range");