Re: Float8 precision problem

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
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:07
Message-ID: D425483C2C5C9F49B5B7A41F8944154757DDBB@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

And (indeed) that is exactly the answer that you received [within
DLB_DIG units of precision].

I guess that you will be happier with NUMERIC(precision, scale) because
the results of operations will be closer to what you expect.

Suggested reading:
http://www.physics.ohio-state.edu/~dws/grouplinks/floating_point_math.pd
f

________________________________________
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Hengki
Suhartoyo
Sent: Thursday, November 30, 2006 2:56 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Float8 precision problem

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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kaloyan Iliev 2006-11-30 11:03:19 Re: Float8 precision problem
Previous Message Hengki Suhartoyo 2006-11-30 10:56:08 Float8 precision problem