General Bug Report: Incorrect subtraction - rounding error - should NOT round!

Unprivileged user <nobody>

From: Unprivileged user <nobody>
To: pgsql-bugs@postgresql.org
Date: 1999-01-12T02:37:11Z
Lists: pgsql-bugs
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name		: Jeffrey Springer
Your email address	: jspringr@savemail.com

Category		: runtime: back-end: SQL
Severity		: critical

Summary: Incorrect subtraction - rounding error - should NOT round!

System Configuration
--------------------
  Operating System   : FreeBSD 2.2.7

  PostgreSQL version : 6.3.2

  Compiler used      : gcc 2.7

Hardware:
---------
AMD K6 with 32M Ram

Versions of other tools:
------------------------
gmake

--------------------------------------------------------------------------

Problem Description:
--------------------
I put together a banking web-site using Postgres. I put a
check and deducted the amount from the balance column of
the bank_account table. The result was incorrect so I tested
it inside psql instead of my C++ program but got the
same result.

--------------------------------------------------------------------------

Test Case:
----------
template1=> select 166952.9 - 166384.34 ;
	?column?
----------------
568.559999999998
(1 row)

--------------------------------------------------------------------------

Solution:
---------


--------------------------------------------------------------------------