Re: [HACKERS] Floating point error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Floating point error
Дата
Msg-id 12107.1362508727@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Floating point error  (Maciek Sakrejda <m.sakrejda@gmail.com>)
Ответы Re: [HACKERS] Floating point error  (Tom Duffey <tduffey@trillitech.com>)
Список pgsql-general
Maciek Sakrejda <m.sakrejda@gmail.com> writes:
> On Tue, Mar 5, 2013 at 10:23 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Basically, the default behavior is tuned to the expectations of people
>> who think that what they put in is what they should get back, ie we
>> don't want the system doing this by default:
>>
>> regression=# set extra_float_digits = 3;
>> SET
>> regression=# select 0.1::float4;
>> float4
>> -------------
>> 0.100000001
>> (1 row)
>>
>> regression=# select 0.1::float8;
>> float8
>> ---------------------
>> 0.10000000000000001
>> (1 row)
>>
>> We would get a whole lot more bug reports, not fewer, if that were
>> the default behavior.

> Isn't this a client rendering issue, rather than an on-the-wire encoding issue?

Nope, at least not unless you ask for binary output format (which
introduces a whole different set of portability gotchas, so it's
not the default either).

            regards, tom lane


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

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Re: [HACKERS] Floating point error
Следующее
От: Tom Duffey
Дата:
Сообщение: Re: [HACKERS] Floating point error