Rounding in database not correct ?? 
Author Message
 Rounding in database not correct ??

Hi All,

I have a DBase 4 table with a field of type Float (2 decimals).
When I do the following calculation:
Totaal := ((Aantal * PerDuizend)/1000) + Vast + Wijz;  
(10080 * 106/1000) + 35,28 + 25,36
(Which is 1129,12)
When I write the var Totaal to a memo (FloatToStr)
I also get that value ( with some extra numbers)
When I do:
Form1.Table1.FindField('TOT').AsFloat := Totaal;
The field TOT gives me the number 1129,10
The displayformat is set to ,#.00
and the fieldkind is fkData
Currency is false (makes no difference when I set it to true)
Precision is set to 15

Anybody know what I am doing wrong ??

Thanks in advance

Wed, 18 Jun 1902 08:00:00 GMT  
 Rounding in database not correct ??

Wed, 18 Jun 1902 08:00:00 GMT  
 Rounding in database not correct ??

To answer my own question:
Field size was set to 6 positions,
1129,12 is seven positions...
so: six are shown, filled up with one zero
(because of the displayformat)
So simple yet it has puzzled me for days....

Frank Vogel

Wed, 18 Jun 1902 08:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Month number being returned not correct

2. Active Buffer seems not to work correct

3. TDatasetProvider doesn't formulate correct update statement

4. Database Problem: "Not Initialized for Network"

5. checking for correct data entry or preventing that it can be done

6. How display correct data in DbGrid?

7. Need help on setting the correct languagedriver for a table

8. modify view from delphi dont work correct ?

9. Correct Method ?

10. FPC: recursive "FileFind", corrected...

11. you'r correct

12. TFieldDefs.Add function - what are the CORRECT parameters for Delphi 1.0


Powered by phpBB® Forum Software