wrong addition in select
------------------------
Key: CORE-3760
URL: http://tracker.firebirdsql.org/browse/CORE-3760
Project: Firebird Core
Issue Type: Bug
Affects Versions: 2.5.1, 2.1.4
Environment: Windows 7 Professional, Intel Core i5/i7 (multiple
Machines), Dialect 1,
Reporter: Jan Kohlmeyer
Hello,
my select with a harmless addition brings a wrong result, this was executes
with isql.exe:
SQL> select 138 + 70 -79.86 - 85.27 from rdb$database;
SUBTRACT
=======================
42.86999999999999
The correct result ist 42.87.
You can also execute this:
select 138 + 70 -79.86 - 85.27
from rdb$database
where 138 + 70 -79.86 - 85.27 <> 42.87;
And you will get a result. This is better if you are using an IDE that uses
Displayformats, likeIBExpert, instead isql.exe.
You can also create a table with this values and select them with the
sum-function and you will recive a similar result:
SQL> select sum(test) from tbltest having sum(test) <> 42.87;
SUM
=======================
42.87
Here is the Script to create the table:
CREATE TABLE tbltest (
ID INTEGER NOT NULL,
test numeric(15,2),
CONSTRAINT PK_tbltest PRIMARY KEY (ID));
INSERT INTO tbltest (ID, test) VALUES (1, 138);
INSERT INTO tbltest (ID, test) VALUES (2, 70);
INSERT INTO tbltest (ID, test) VALUES (3, -79.86);
INSERT INTO tbltest (ID, test) VALUES (4, -85.27);
Greetings
Jan
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel