TonyTebby writes:
<>
> 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)
Good one! The same would presumably apply to any scheme devised to do the
maths, ie you could just as well use IEEE fp, eg
result$ = "sEEEE.sMMMMMMMM" - "sEEEE.sMMMMMMMM"
if you see what I mean. In fact you could probably cater for both string
arithmetic and IEEE by, for example, prefixing a marker to the IEEE
numbers.
The only disadvantage with this approach is that it would break a
fundamental compatibility with Qdos. Perhaps that doesnt matter?
> Isn't it great being able to think up work for other people to do - I am
> enjoying myself!
Welcome to the club!
Per