Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2
Дата
Msg-id
19770.965743484@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Philip Warner <pjw@rhyme.com.au>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Philip Warner <pjw@rhyme.com.au>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Don Baccus <dhogaza@pacifier.com>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Philip Warner <pjw@rhyme.com.au>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Don Baccus <dhogaza@pacifier.com>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Philip Warner <pjw@rhyme.com.au>
Re: Re: [GENERAL] Trouble with float4 afterupgrading from 6.5.3 to 7.0.2 Don Baccus <dhogaza@pacifier.com>
Philip Warner  writes:
> Given this, I have assumed that printf etc use these least significant bits
> to determine the 'correct' representation.

No.  What float4-to-text really does is *discard* information, by
rounding off the printed result to only 7 digits (when there are
actually 7-and-change in there).  This means values that are actually
distinct float4 values may get printed as the same thing:

regression=# select 1.234567 :: float4;
 ?column?
----------
  1.23457
(1 row)

regression=# select 1.234568 :: float4;
 ?column?
----------
  1.23457
(1 row)

regression=# select 1.234567 :: float4 = 1.234568 :: float4;
 ?column?
----------
 f
(1 row)

regression=# select 1.234567 :: float4 - 1.234568 :: float4;
   ?column?
--------------
 -9.53674e-07
(1 row)

I don't much care for this behavior (since it means dump and reload of
float columns is lossy), and I certainly won't hold still for
introducing it into other operations on floats.

			regards, tom lane
В списке pgsql-hackers по дате отправления
От: Philip Warner
Дата:
От: Don Baccus
Дата:
FAQ