-=> Quoting David Williams to Rick Pedley <=-
DW> I can't think that anything would be much simpler and faster than the
DW> method I posted, involving just calculating a couple of ATNs and
DW> subtracting the results from each other. (Incidentally, after posting
DW> some code that does the job that way, I thought of a way of
DW> streamlining it a tad further. But it wouldn't make much difference.)
It all depends on the application, i.e. the problem to be solved.
Computer things are always digital, not analog, which means there is
a finite number of solutions to the algorithm being used, even with
real numbers providing there is an upper and lower bound; there are
predictable holes in the solution set. If the entire set of possible
solutions can be identified, then there is opportunity for optimization,
e.g. all solutions for square root and trigonometric calculations done
in advance and stored in arrays. That will vastly decrease execution
time. Another approach is something I remember from a Computer Language
article on optimizing code: sometimes we misdirect our efforts in
optimizing a particular algorithm when instead we should be looking for
a completely different solution to the problem; by redefining the problem
and approaching it from another direction we may be able to simplify it,
lateral thinking vs vertical.
--- Blue Wave/DOS v2.20
---------------
* Origin: ...the vented spleen - kingston on (613) 544-9332 (1:249/139)
|