Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.clipper.visual-objects

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 08-21-2010, 06:34 PM
John Gosub
Guest
 
Posts: n/a
Default Incorrect Total of values using ADS Sql

Hello To All, I am using ADS version 10 to sum up some values in SQL
the values are 1636.36, 22.61 the total I am getting is 1658.98 when
it should be 1658.97 I am using the sum function in an sql statement
with VO2.8.
All other grouping are correct except this group. Can someone give me
some help please!!

One Million Thanks!!
John Gosub
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 08-22-2010, 02:15 AM
Geoff Schaller
Guest
 
Posts: n/a
Default Re: Incorrect Total of values using ADS Sql

John,

This kind of thing has nothing to do with it being ADS, DBF or SQL, it
is purely your misunderstanding of what you are looking at and the
precision in question. What is visually presented to you will be the
result of formatting for display as opposed to the underlying data
content, which you need to know. I suspect the data types you are
dealing with store more than two decimal places but your visual
formatting rounds to 2.

For example, let us say the actual data is this:

1636.364
22.614

When you review both items to 2 decimals you see 1636.36 and 22.61 but
when you add these two numbers and then review the result, you MUST get
the answer 1658.98 - that is correct. So this is really Mathematics 101.
You need to decide whether you are going to round and store or keep
precision and round the result. You need to pick a strategy and keep it
consistent throughout the application but these contentions will always
exist.

Another huge error SQL writers often commit is to compare a float value
to zero: SOMETOT <> 0. The trouble here is that if SOMETOT actually held
0.0000000000000001, visually it looks like zero but in actuality, it
isn't.

This issue has been around since 1993 when VO first came out.

Geoff



"John Gosub" <servia@tstt.net.tt> wrote in message
news:a931e52b-5cea-4839-89d4-c3857d986899@m1g2000yqo.googlegroups.com:

> Hello To All, I am using ADS version 10 to sum up some values in SQL
> the values are 1636.36, 22.61 the total I am getting is 1658.98 when
> it should be 1658.97 I am using the sum function in an sql statement
> with VO2.8.
> All other grouping are correct except this group. Can someone give me
> some help please!!
>
> One Million Thanks!!
> John Gosub


Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 05:37 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.