float precision + TADODataSet

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

Comments

  • : 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.


  • : : 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
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories