Bug 146818 - Error when multiplying, dividing, subtracting or adding two Floating Point fields
Summary: Error when multiplying, dividing, subtracting or adding two Floating Point fi...
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Queries (show other bugs)
Version: 1.1.3 (KOffice 1.6.3)
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Jarosław Staniek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-15 12:16 UTC by r.c.drew
Modified: 2008-01-10 17:42 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description r.c.drew 2007-06-15 12:16:25 UTC
Version:           1.1.3 (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

In the following: FP = Floating Point, Int = Integer
If you set up a query to multiply FP x Int, result is FP.  This works fine.
However, the result for FP x Int gives a square with a question mark inside.
Whether the FP number is single or double precision, the same problem occurs.
This has been confirmed by Jarosław Staniek (current project maintainer) who asked me to file the bug.
The same problem exists when adding, subtracting or dividing two FP numbers.
Clearly, Kexi has great potential, and much great work has been done, but it is unusable as a database if any FP numbers are involved!
Comment 1 r.c.drew 2007-06-15 12:28:38 UTC
Sorry, I made a typo: I should have written "However, the result for FP x FP gives a square with a question mark inside".
Comment 2 Jarosław Staniek 2008-01-10 17:41:01 UTC
SVN commit 759457 by staniek:

KexiDB

fix the bug #146818: handling expressions containing 
binary operators like *, /, -, + where both arguments are of 
floating-point type (with single or double precision). 
Previously the result was marked as boolean, now it is 
floating-point.

CCMAIL:146818-done@bugs.kde.org
CCMAIL:kexi@kde.org



 M  +2 -6      expression.cpp  


--- branches/koffice/1.6/koffice/kexi/kexidb/expression.cpp #759456:759457
@@ -400,14 +400,10 @@
 	if (ltInt && rtInt)
 		return KexiDB::maximumForIntegerTypes(lt, rt);
 
-	if (Field::isFPNumericType(lt) && rtInt)
+	if (Field::isFPNumericType(lt) && (rtInt || lt==rt))
 		return lt;
-	if (Field::isFPNumericType(rt) && ltInt)
+	if (Field::isFPNumericType(rt) && (ltInt || lt==rt))
 		return rt;
-	if ((lt==Field::Double || lt==Field::Float) && rtInt)
-		return lt;
-	if ((rt==Field::Double || rt==Field::Float) && ltInt)
-		return rt;
 
 	return Field::Boolean;
 }