Numeric - float, rounding problem
Moderators: gto, EgonHugeist, olehs
Numeric - float, rounding problem
Hi all,
I am using the zeos 922stable, Delphi XE, firebird 2.5.
I have a numeric (10.4) field. When recording in this field have already signed up some numbers wrong.
Example
Correct -> Wrong
1.95 -> 1.9444,
0.18 -> 0.1799
0.85 -> 0.8499
Is this a bug? What would you recommend me to do.
Thanks
I am using the zeos 922stable, Delphi XE, firebird 2.5.
I have a numeric (10.4) field. When recording in this field have already signed up some numbers wrong.
Example
Correct -> Wrong
1.95 -> 1.9444,
0.18 -> 0.1799
0.85 -> 0.8499
Is this a bug? What would you recommend me to do.
Thanks
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
the problem is due to the float representation 1.95 is in fact stored as 1.94999... The problem is that when writing it to DB it does not get rounded but truncated... I didn't notice that behavior on postgresql I'm working with so my guess is the problem is in interbase (firebird) part of zeos. Would you be able to find and fix it?
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
when i define the field manually, system does not allow anything but float. when i define it as float i enter any number i want, like 0,6000 and post it, however when i refresh it, it is displayed as 0,5999. And this is even not valid for every number. For example if I post 1,1450, i can do that. the number that is logged into the data base and the number I stored are not the same. All process regarding post and delete require to use zsqlprocessor.
I found no other alternatives.
Thanks
I found no other alternatives.
Thanks
-
- Expert Boarder
- Posts: 113
- Joined: 06.10.2006, 14:41
- Location: Chapecó - Santa Catarina
- Contact:
-
- Zeos Dev Team
- Posts: 32
- Joined: 22.10.2005, 08:53
- Location: Bloemfontein
- Contact:
Confirmation of a bug with this.
I have a system that uses up to 10 decimals in some cases and this bug caught me.
The problem lies in UpdateBigDecimal in ZDBCInterbase6Utils
Please can you upload the code for your function so that I can see if I have a fix for it, It is possible that I have not made a commit for this fix.
The problem lies in UpdateBigDecimal in ZDBCInterbase6Utils
Please can you upload the code for your function so that I can see if I have a fix for it, It is possible that I have not made a commit for this fix.