Re: rounding problems

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: rounding problems
Дата
Msg-id 20080514143817.GF1657@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: rounding problems  (Justin <justin@emproshunts.com>)
Ответы Re: rounding problems
Список pgsql-general
On Tue, May 13, 2008 at 02:36:18PM -0400, Justin wrote:
> Double holds 15 places which is the highest value of precision it can
> maintain before rounding occurs.
>
> Is is limit less no, but what is?
>
> Practically speaking  taking a vale 0.000,000,000,000,001 aka
> 1 trillionth of anything,

But remember that if you add this value onto a large number and then
take off the large number the result will be zero.

  (0.000,000,000,01 + 1,000,000) - 1,000,000  ==>  0
  0.000,000,000,01 + (1,000,000 - 1,000,000)  ==>  0.000,000,000,01

In general, operations on floating point numbers will increase their
errors.

> i view the problem solved for 98% of problems.

Floating point math is good for most problems, hence why most languages
expose the abstraction.


  Sam

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

Предыдущее
От: Decibel!
Дата:
Сообщение: Re: ranked subqueries vs distinct question
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: ranked subqueries vs distinct question