Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread calculating problem
Tue, Mar 20 2018 2:04 PMPermanent Link

Paul Waegemans

IMS bvba

Avatar

I have a DBISAM table with the fields

verbruik : integer
prijs :  BCD (2)
totaal : BCD (2)

When I go through the table calculating as follows

with grid1.dataset do
    begin
    first;
    while not eof do
          begin
          if state=dsbrowse then update;
          columns['verbruik'].asinteger:=columns['begin'].asinteger-columns['eind'].asinteger;
          columns['bedrag'].asfloat:=columns['verbruik'].asinteger*columns['prijs'].asfloat;
          next;
          end;
    end;

I see a weird result (see screenshot)

18 * 1.70 = 30,6   result is EWB grid = 30,59999999998

Paul.



Attachments: Picture0001.jpg
Tue, Mar 20 2018 2:15 PMPermanent Link

Walter Matte

Tactical Business Corporation


This is not EWB this the Browser and Javascript doing this.  Google javascript math accuracy.

On the Field Definition set the decimals to 2 it  will round.

Walter
Tue, Mar 20 2018 2:16 PMPermanent Link

Walter Matte

Tactical Business Corporation

Thu, Mar 22 2018 10:19 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

PROBLEM SOLVED !!  Thanks!


Walter Matte wrote:


This is not EWB this the Browser and Javascript doing this.  Google javascript math accuracy.

On the Field Definition set the decimals to 2 it  will round.

Walter
Image