Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
float precision + TADODataSet Posted by _yilmaz on 7 Oct 2004 at 4:53 AM
Hi all;

I have a table in MS Access and it has a float field in it. I retrieve the records of this table by using a TADODataSet.

But a float number that resides in the physical table as 4,3 is displayed as 4,30000019073486.

I changed the precision of TFloatField and also in MS Access table, but this does not work. What should I do?

Thanx,
_yilmaz
Report
Re: float precision + TADODataSet Posted by Masterijn on 7 Oct 2004 at 8:28 AM
: Hi all;
:
: I have a table in MS Access and it has a float field in it. I retrieve the records of this table by using a TADODataSet.
:
: But a float number that resides in the physical table as 4,3 is displayed as 4,30000019073486.
:
: I changed the precision of TFloatField and also in MS Access table, but this does not work. What should I do?
:
: Thanx,
: _yilmaz
:
It seems that the float is of a single type with has a accuracy about 7/8 digits (it's not 10 but 2 based, that's why you get ...19073486).

If the accuracy is good enough than just format the value with less digits. Otherwise choose a double precision type in access-table.


Report
Re: float precision + TADODataSet Posted by rajsha on 7 Oct 2004 at 10:13 AM
: : Hi all;
: :
: : I have a table in MS Access and it has a float field in it. I retrieve the records of this table by using a TADODataSet.
: :
: : But a float number that resides in the physical table as 4,3 is displayed as 4,30000019073486.
: :
: : I changed the precision of TFloatField and also in MS Access table, but this does not work. What should I do?
: :
: : Thanx,
: : _yilmaz
: :
: It seems that the float is of a single type with has a accuracy about 7/8 digits (it's not 10 but 2 based, that's why you get ...19073486).
:
: If the accuracy is good enough than just format the value with less digits. Otherwise choose a double precision type in access-table.
:
:
:
You can mask the property of the DBEdit or Edit with a mask such as #.000 where 0 is added for every decimal place. You can format the number with roundto(number,-X) where x is an integer for the number of decimal places, in this case u will have to add the Maths unit to Uses



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.