[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Classic game LUNAR and G=1E-03



sicklittlemonkey wrote:
On May 4, 6:48 pm, Nama <forums6...@mac.com> wrote:
If that is the case, then what would be the replacement for:
(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30)

Er,
Q*(1/2+Q*(1/6+Q*(1/12+Q*(1/20+Q/30))))

And this is a substitution well worth making, since most microcomputer
BASICs will compute integer powers by taking a natural log, multiplying
by the power, then exponentiating--all of which takes a *long* time
compared to a multiplication, a division, and an add!

Of course the division by constants can be eliminated by doing it
once outside the subroutine, making the cost of each term just one
add and one multiply.

-michael

NadaNet 3.0 for Apple II parallel computing!
Home page:  http://home.comcast.net/~mjmahon/

"The wastebasket is our most important design
tool--and it's seriously underused."