So finally we arrive at numbers in strings so why not use string arithmetic
as suggested by a number of correspondents ?

As it happens Jonathon Oakley has already written the basic (rather than
SBASIC)  routines to carry out unlimited precision arirthmetic on strings
(nearly unlimited - there might be some problems going beyond 32766
significant digits).

This would eliminate the rounding errors that plague commercial software not
written in COBOL.

These routines are built into the simple calculator in QPAC1. I think Jochen
has the sources, but I do not think that these have been transferred to Wolf
yet.

No need for fancy modifications - the SBASIC arithmetic routines already
check the types of the variables involved in calculations and do different
operations for integers and floats. All you need to do is detect
string{+-*/}string and do string arithmetic with string result instead of
float. Lau Has a really dinky routine for doing square root in the same
number of operations as divide and other more complex functions can be left
for later.

    A$ = "123456789.0000000001" - "123456789"

    would give A$ = ".0000000001" - IEEE double precision will never give
you that result - it would be quicker, but wrong. Do you want it quick or
right?

The only "parameterisation" required is setting the maximum precision for
inexact operations (divide, square root, non positive integer powers and
trig)

Isn't it great being able to think up work for other people to do - I am
enjoying myself!

Tony Tebby

----- Original Message -----
From: "Dave Walker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: samedi 15 mars 2003 00:06
Subject: Re: [ql-users] Sbasic and numbers



Reply via email to