Re: (Bug) Numeric fault calculation

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: (Bug) Numeric fault calculation
Дата
Msg-id 1371589776.2530.40.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: (Bug) Numeric fault calculation  (Chirag Mittal <linux@seasonstravel.co.in>)
Ответы Re: (Bug) Numeric fault calculation  (David Johnston <polobo@yahoo.com>)
Re: (Bug) Numeric fault calculation  (David Johnston <polobo@yahoo.com>)
Список pgadmin-support
On Sun, 2013-06-16 at 04:59 -0700, Chirag Mittal wrote:
> Dear Kanitchet,
> 
> Please try this 
> 
> SELECT (260739.94 * (1.00/365.00))::numeric(20,7)
> 
> I am a beginner but I think we need to explicitly mention the "output"
> format required to get accuracy.
> 

Nope, you simply need to use the right datatype. If you use a floating
point datatype (which is what happens when you don't specificy the
type), you cannot claim to get exact precision. If you need the
accuracy, you need the numeric datatype (just as you did with the query
above).


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com




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

Предыдущее
От: AI Rumman
Дата:
Сообщение: Re: [GENERAL] Postgres DB crashing
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: SQL editor view, Add favourite disabled