Re: Float8 precision problem

From: Kaloyan Iliev <news1(at)faith(dot)digsys(dot)bg>
To: Hengki Suhartoyo <hengman03(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Float8 precision problem
Date: 2006-11-30 11:03:19
Message-ID: 456EBA77.8010002@faith.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

What about cast to numeric?

select 6.1::numeric-6::numeric ;
?column?
----------
0.1
(1 row)

Regards,
Kaloyan Iliev

Hengki Suhartoyo wrote:

> Hi all,
>
> I got problem in postgrsql 8.0 when subtraction in float8, this is my
> query :
> select 6.1::float8-6::float8
>
> Result>>> 0.099999999999996
>
> I need the result like natural subtraction is 0.1
>
> Help me please....
>
> ------------------------------------------------------------------------
> Want to start your own business? Learn how on Yahoo! Small Business.
> <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Teodor Sigaev 2006-11-30 11:16:20 Re: postgresql 8.2 rc1 - crash
Previous Message Dann Corbit 2006-11-30 11:03:07 Re: Float8 precision problem