Solved

Floating point numbers with Direct Access connection

Posted on 1999-01-05
4
130 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now