[AccessD] roundup - decimal places

Wortz, Charles CWortz at tea.state.tx.us
Mon Apr 7 10:42:50 CDT 2003


Pedro,
 
Remember, you are working on a binary computer.  Thus decimal numbers
must be approximated as the sum of powers of two.  For integer numbers
these approximations are exact representations.  For floating point
numbers, these approximations are just that - approximations.  None of
your floating point numbers are stored with just one digit to the right
of the decimal point, they are only displayed to you as such.
 
If you cannot learn to live with floating point numbers, then convert
them to the currency datatype.  The currency datatype will meet many of
you computational needs.
 
 

Charles Wortz 
Software Development Division 
Texas Education Agency 
1701 N. Congress Ave 
Austin, TX 78701-1494 
512-463-9493 
CWortz at tea.state.tx.us 

-----Original Message-----
From: Pedro Janssen [mailto:pedro at plex.nl] 
Sent: Monday 2003 Apr 07 10:30
To: AccessD at databaseadvisors.com
Subject: [AccessD] roundup - decimal places


Hello Group,
 
i have a tableA with 5 fields (field size: single, decimal places:1)
Not all fields have values.
I want the difference from al those field, so i added a field diff.
I made an update query with the following sql:
 
UPDATE TableA SET TableA.[diff] = 100-Nz([field1],0)-Nz([[field2],0)-
etc. etc.;

The result that i get in field diff gives many records with more then 1
decimal places.
 
For example: When i have a record which contains values like 5,1 and
94,9 (all values are typed in this way and are not calculated) i get as
result 0,11176548
or a record that contains values like 20,5 and 20,5 i get as result
59,997854.
Some result do have only one decimal place.
 
How is this possible? 
 
TIA
 
Pedro Janssen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030407/67679867/attachment-0001.html>


More information about the AccessD mailing list