<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2719.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=736132213-08042003><FONT color=#0000ff
size=2>JC,</FONT></SPAN></DIV>
<DIV><SPAN class=736132213-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=736132213-08042003><FONT color=#0000ff size=2>Ah yes,
BCD. I worked with it for many years. As far as I am aware, no
modern binary computer still has this datatype as a native
(hardware) numeric representation. You are correct in how it
worked. On machines such as the IBM 1620 you could manipulate BCD numbers
of any length you desired, up to the memory limits of the machine. This
was back in the days when 16K was a lot of memory!</FONT></SPAN></DIV>
<DIV><SPAN class=736132213-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=736132213-08042003><FONT color=#0000ff size=2>One correction to
your comments. Currency is not a floating point number datatype.
AFAIK all languages that support the currency datatype represent it as a long
integer in the hardware and use software to keep track of the implied decimal
point. Thus it is referred to as a scaled integer. If anybody knows
whether Intel, AMD or any of the other chip makers have imbedded the currency
datatype into their hardware I would be interested in knowing
that.</FONT></SPAN></DIV>
<DIV> </DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-us><B><FONT color=#0000ff>Charles Wortz</FONT></B></SPAN>
<BR><SPAN lang=en-us><FONT color=#0000ff>Software Development
Division</FONT></SPAN> <BR><SPAN lang=en-us><FONT color=#0000ff>Texas Education
Agency</FONT></SPAN> <BR><SPAN lang=en-us><FONT color=#0000ff>1701 N. Congress
Ave</FONT></SPAN> <BR><SPAN lang=en-us><FONT color=#0000ff>Austin, TX
78701-1494</FONT></SPAN> <BR><SPAN lang=en-us><FONT
color=#0000ff>512-463-9493</FONT></SPAN> <BR><SPAN lang=en-us><FONT
color=#0000ff>CWortz@tea.state.tx.us</FONT></SPAN> </P>
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> John W. Colby
[mailto:jcolby@ColbyConsulting.com] <BR><B>Sent:</B> Tuesday 2003 Apr 08
08:12<BR><B>To:</B> accessd@databaseadvisors.com<BR><B>Subject:</B> RE:
[AccessD] roundup - decimal places<BR><BR></FONT></DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff
size=2>Charles,</FONT></SPAN></DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff size=2>Are
you sure that Currency is just a scaled floating pt number? I'm sure you
know, but for the edification of those who may not, in the old days you had a
form of data called BCD for binary coded decimal. BCD is a system where
decimal DIGITS are stored in 4 bits. Since 4 bits can represent the
values 1-15, any decimal digit can then be represented exactly without any
rounding error at all due to inexact representation in binary storage.
Then a program (functions in the math library) would manipulate strings of
binary coded decimal DIGITS to allow absolutely precise decimal arithmetic out
to the specified precision, with no errors introduced due to binary storage
techniques. It was my understanding that the currency datatype was a BCD
datatype, scaled to 4 decimal digits right of the decimal
point.</FONT></SPAN></DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff size=2>My
understanding also is that floating point numbers are simply a binary
approximation stored in an 80 bit number with various combinations of the bits
used for the digit and the fraction. Thus NO floating point numbers
(results) can be guaranteed to be correct if enough calculations are performed
since the results are always stored back into a binary format, introducing
binary storage errors in representing what are supposed to be decimal numbers
(down in the lowest decimal digit). IOW, the rightmost digit will ALWAYS
have an error, and as you perform more and more calculations, those errors may
"creep" upwards into the next digit, and the next etc. The more
calculations you perform, the more error creep may possibly
occur.</FONT></SPAN></DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=240445812-08042003><FONT face=Arial color=#0000ff size=2>BCD,
and Currency IF it is based on BCD, will never have this error creep since the
system is based on exact representations of decimal DIGITS and no binary
representation is ever used at any stage of the calculation.</FONT></SPAN></DIV>
<P><FONT size=2>John W. Colby<BR>Colby
Consulting<BR>www.ColbyConsulting.com</FONT> </P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
accessd-bounces@databaseadvisors.com
[mailto:accessd-bounces@databaseadvisors.com]<B>On Behalf Of </B>Wortz,
Charles<BR><B>Sent:</B> Tuesday, April 08, 2003 8:42 AM<BR><B>To:</B>
accessd@databaseadvisors.com<BR><B>Subject:</B> RE: [AccessD] roundup -
decimal places<BR><BR></FONT></DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff
size=2>Pedro,</FONT></SPAN></DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff size=2>You seem to
have a misconception of how computers work. They are binary (base 2) not
decimal (base 10). Thus numbers can only be represented as the sum of
powers of two. Since all integers (numbers without fractional parts) can
be represented exactly as the sum of powers of two they can be stored and
manipulated without any loss of precision (excepting division
operations).</FONT></SPAN></DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff size=2>All floating
point numbers (numbers with fractional parts), except for those rare ones
where the fractional part is an exact sum of powers of two, must be
represented by an approximation of its value. The precision of a
floating point number tell you how close to actual value the approximate value
can come. Thus for Singles with about seven digits of precision, you
know that up to the seventh digit accurately represent the actual value and
any digits beyond that should not be counted on to be
accurate.</FONT></SPAN></DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff size=2>Thus you must
choose between the exact representation of integers and the approximate
representation of floating point numbers. In later versions of VB and
other languages there is now a third choice, the currency datatype. This
is a compromise between the two fundamental numeric datatypes. It is a
scaled integer used to represent floating point numbers where you do not want
more than four digits of precision for the fractional
part.</FONT></SPAN></DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=033572412-08042003><FONT color=#0000ff size=2>To get what you
want, you must pick from these numeric datatypes and then use the proper
rounding and formatting functions to get the numbers to display as you
desire. There are no other choices if you are going to do it on a
computer.</FONT></SPAN></DIV>
<DIV> </DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-us><B><FONT color=#0000ff>Charles Wortz</FONT></B></SPAN>
<BR><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Pedro
Janssen [mailto:pedro@plex.nl] <BR><B>Sent:</B> Tuesday 2003 Apr 08
06:17<BR><B>To:</B> accessd@databaseadvisors.com<BR><B>Subject:</B> Re:
[AccessD] roundup - decimal places<BR><BR></FONT></P>
<DIV><FONT face=Arial size=2>Hello Charlotte,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>i want truly round numbers with 1
precision.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Pedro Janssen</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=cfoust@infostatsystems.com
href="mailto:cfoust@infostatsystems.com">Charlotte Foust</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, April 07, 2003 7:41
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [AccessD] roundup -
decimal places</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=869084117-07042003><FONT face="Comic Sans MS" color=#0000ff
size=2>You're going to have to explain whether you want to truly round
numbers or just display them that way. The Decimal places setting
addresses the display, not the precision.</FONT></SPAN></DIV>
<DIV><SPAN class=869084117-07042003><FONT face="Comic Sans MS" color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=869084117-07042003><FONT face="Comic Sans MS" color=#0000ff
size=2>Charlotte Foust</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Pedro
Janssen [<A href="mailto:pedro@plex.nl">mailto:pedro@plex.nl</A>]
<BR><B>Sent:</B> Monday, April 07, 2003 9:25 AM<BR><B>To:</B> <A
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A><BR><B>Subject:</B>
Re: [AccessD] roundup - decimal places<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Hello Charles,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>when i type 5,1 i type 5,1 and not
.</FONT></DIV>
<DIV><FONT face=Arial size=2>How does a computer changes 5,1 into
5,11415899 although i type 5,1.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>What is the use of decimal places:1, with
field size: single, when the pc makes a lott of decimal places from it.
Then this property better wasn't available when using numbers (not
currency).</FONT></DIV>
<DIV><FONT face=Arial size=2>Is there a way to roundup the numbers to
1decimal place without using currency.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Pedro Janssen</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=CWortz@tea.state.tx.us
href="mailto:CWortz@tea.state.tx.us">Wortz, Charles</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, April 07, 2003 5:42
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [AccessD] roundup -
decimal places</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=853123615-07042003><FONT color=#0000ff
size=2>Pedro,</FONT></SPAN></DIV>
<DIV><SPAN class=853123615-07042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=853123615-07042003><FONT color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=853123615-07042003><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=853123615-07042003><FONT color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV> </DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-us><B><FONT color=#0000ff>Charles
Wortz</FONT></B></SPAN> <BR><FONT face=Tahoma size=2>-----Original
Message-----<BR><B>From:</B> Pedro Janssen [mailto:pedro@plex.nl]
<BR><B>Sent:</B> Monday 2003 Apr 07 10:30<BR><B>To:</B>
AccessD@databaseadvisors.com<BR><B>Subject:</B> [AccessD] roundup -
decimal places<BR><BR></FONT></P>
<DIV><FONT face=Arial size=2>Hello Group,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>i have a tableA with 5 fields (field size:
single, decimal places:1)</FONT></DIV>
<DIV><FONT face=Arial size=2>Not all fields have values.</FONT></DIV>
<DIV><FONT face=Arial size=2>I want the difference from al those field,
so i added a field diff.</FONT></DIV>
<DIV><FONT face=Arial size=2>I made an update query with the following
sql:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>UPDATE TableA SET TableA.[diff] =
100-Nz([field1],0)-Nz([[field2],0)- etc. etc.;<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>The result that i get in field diff gives
many records with more then 1 decimal places.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>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</FONT></DIV>
<DIV><FONT face=Arial size=2>or a record that contains values like 20,5
and 20,5 i get as result 59,997854.</FONT></DIV>
<DIV><FONT face=Arial size=2>Some result do have only one decimal
place.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>How is this possible? </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>TIA</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Pedro
Janssen</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>