It's about basic , more specific Freebasic.
Wrote an interface for the NewtonRaphson - very general , but now it has to take 12 complex powers to start ...
Works great , but slow.
The reason is that it calculates something as
a*z^7 + b*z^6 + .... a0 ... of course in many cases the constants (like pe "b") are 0 (see code) and there is no need in calculating the power, the result will be 0 anyway .. is there an elegant way besides nesting/building if's to do this ..
in Lisp (because it's functional) one can say (+ ... (when (not (zero? a)) (* a (expt z 7))) .... (when (not (zero? b .... etc ..
Is the only way something as
if a <> 0 then result = result + a*calculation
if b <> 0 then result = resiult + b* ..... etc
or can one write macro's for this
... or even conditional compiling ??
thanks in advance
Rob
.