Henry Miller wrote:


On 11/1/2005 at 21:59 [EMAIL PROTECTED] wrote:


John Stanton <[EMAIL PROTECTED]> wrote:

Users love such a number system because it is natural and works like

the
Arithmetic they learned in Grade School.

I find the idea of dividing two integers stored in binary form and getting a gratuitous conversion to floating point ugly and

potentially
very annoying.

I admit that it has been 4 decades since I was in grade school,
but back in the 60's we were taught that 5/2 is 2.5.  Are they
teaching something different now?  Or have I misunderstood the
comment?


You are missing the point:  What did your grade school teacher tell you
about 1/3?   What about pi, or e, to name two common numbers that
cannot be stored easily.
As for 5/2, my grade school teachers taught me that if I round it at
all, the answer is 3, NEVER 2.   It is only latter in life that I
learned about bankers rounding which sometimes is 2, sometimes 3.    I
have never seen a justification for rounding to 2, except for the bogus
answer that it is easy for the computer to do.   Thus I conclude
whatever the final answer is, sqlite would be wrong if 5/2 is always 2.

After reading all the comments I've concluded that the only correct
answer is to make all the arithmetic operators replaceable.   Let those
who care define their own math.

When I do math homework (though why you would use sqlite for homework
problems I don't know) if the formula is pi*r^2 (area of a circle), if
r is 4, my answer should be 8*pi.  If I'm doing engineering
calculations on the same thing, I want 24.3 (perhaps to a few more
decimal places.

Bankers may want 5/2 to be 2, or 3, depending on how they round it.
I say do whatever you want - anyone who cares about this issue would
not be doing math in any database anyway. because the SQL standard
requires the wrong answer for their real-world application.  It will be
a consistent wrong answer, but it will still be wrong.



a. The purpose of rounding rules is to avoid drift.

b. In school 1/3 is taught to be precisely 1.3' (should be a superscript dot to indicate repeat). It is taught to be 1.33 to two decimal places precision.

c. Transcendental/irrational numbers are always a problem regardless of how you store them. Calculating them to the precision you need is a sound practice.

d. The Ancient Egyptians had a number system based on fractions, and it was deadly accurate and quite concise. Grade school teachers don't explain the Egyptian method, but good Math teachers do a little further along in the education process.

Reply via email to