Solved

Floating point numbers with Direct Access connection

Posted on 1999-01-05
4
149 Views
Last Modified: 2013-11-23
Most floating point numbers look weird in SQL Explorer.
If I have 2.1 in Access table, it becames something like 2.099999999187487325. I use Delphi 4.02/Access 97.
0
Comment
Question by:eugenem
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1354728
This is because floating point values are only represented approximately by the floating point numeric types. 2.099999999187487325 will be the closest approximation to 2.1 that the particular field in the table you are viewing can manage. If displayed to 1 decimal place you would get 2.1.

This is a fundamental problem with floating point number representation and manipulation in software development and you need to be aware of this to avoid certain problems and pitfalls.

Cheers,

Raymond.
0
 
LVL 3

Author Comment

by:eugenem
ID: 1354729
So what could I do in this case?
0
 
LVL 3

Author Comment

by:eugenem
ID: 1354730
I was needed to change Precision property of corresponding TField to some small value.
Question is closed.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 1354731
I believe my answer stands. It did contain the reference to displaying to one decimal place...

Raymond.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tidtcpserver connection lost handle 2 110
When i run adoquery my application freezes 26 188
SUM 2 INTEGER ARRAYS INTO 1 10 111
FMX TEdit KeyUp handler detecting  "enter" key 4 39
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question