Re: [COMMITTERS] pgsql: Check for ERANGE in exp()

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [COMMITTERS] pgsql: Check for ERANGE in exp()
Дата
Msg-id 200701062020.l06KKkC22255@momjian.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Check for ERANGE in exp() as well.  (Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
Ответы Re: [COMMITTERS] pgsql: Check for ERANGE in exp()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Stefan Kaltenbrunner wrote:
> Bruce Momjian wrote:
> > Log Message:
> > -----------
> > Check for ERANGE in exp() as well.
>
> this broke the regression tests on a number of boxes:
>
> http://buildfarm.postgresql.org/cgi-bin/show_status.pl
>
> example:
>
> http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sponge&dt=2007-01-06%2015:30:02

Thanks.  This is something I wanted to ask Tom about today.  I was
worried that ERANGE could be generated by underflow as well as overflow,
and setting result to Inf would not work for underflow.  I have applied
the following patch to test for != 0 and != Inf, which should elimintate
the underflow case.

Tom, on HPPA, does ERANGE get set for both overflow and underflow?  I
assume only overflow.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/utils/adt/float.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.145
diff -c -c -r1.145 float.c
*** src/backend/utils/adt/float.c    6 Jan 2007 15:18:02 -0000    1.145
--- src/backend/utils/adt/float.c    6 Jan 2007 20:15:22 -0000
***************
*** 1459,1465 ****
          else
              result = 1;
      }
!     else if (errno == ERANGE && !isinf(result))
          result = get_float8_infinity();

      CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
--- 1459,1465 ----
          else
              result = 1;
      }
!     else if (errno == ERANGE && result != 0 && !isinf(result))
          result = get_float8_infinity();

      CHECKFLOATVAL(result, isinf(arg1) || isinf(arg2), arg1 == 0);
***************
*** 1478,1484 ****

      errno = 0;
      result = exp(arg1);
!     if (errno == ERANGE && !isinf(result))
          result = get_float8_infinity();

      CHECKFLOATVAL(result, isinf(arg1), false);
--- 1478,1484 ----

      errno = 0;
      result = exp(arg1);
!     if (errno == ERANGE && result != 0 && !isinf(result))
          result = get_float8_infinity();

      CHECKFLOATVAL(result, isinf(arg1), false);

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Parsing ambiguity for ORDER BY ... NULLS FIRST/LAST
Следующее
От: Dave Page
Дата:
Сообщение: Re: -f option for pg_dumpall