Colin McKay wrote:
> So when there is any chance that ACOS has to work on any number close to 1,
> or -1, a check such as IF VV>1 THEN : VV=1 has to be incorporated on every
> occasion?
>
> Takes some of the slickness off the programming.

Well, working with floating point variables can be ugly. QDOS tries
its best to hide the fact by rounding values generously. QPC uses the
PC processor to execute many mathematical instructions and the problem
might be that it produces a more exact result than QDOS would have.
But in this case I cannot reproduce your error, so I don't know if
this is the case here.

In this case the problem boils down to

x = SQRT(1-1.000000001^2) because ACOS(x)=ATAN(SQRT(1-x^2)/x).

The term is negative and thus SQRT cannot work here.

I guess you could re-order your calculation so the error happens on
the lower side, i.e. 0.999999999 instead of 1.000000001.

Small aside: floating point numbers almost always contain an error,
even an innocent looking number like "0.1" cannot be expressed
without. It's 0.10000000000000000555111512312578270211815834045410...
in reality, that you see 0.1 on screen is just the result of some
rounding going on.

All the best, Marcel

_______________________________________________
QL-Users Mailing List

Reply via email to