Optimize this ecuations

Started by
16 comments, last by q2guy 21 years, 9 months ago
dont divide, multiply by the reciprocal.
Advertisement
doing the reciprocal is the same, 3 div ( for do the 3 reciprocals) and 3 mul after
Hi,

Try:
Pauls Square Root Page
http://www.azillionmonkeys.com/qed/sqroot.html

Best Regards,
- James

Compiler macro?
compiler macro? :? what?
After a little more consideration a compiler macro probably wouldn''t be useful, since you won''t know the value of x at compile time. Of course, if you knew the fixed depth of the recursion, you could still program a compiler macro to convert the function to a simpler form...

...there was a good article on such techniques in the first Game Programming Gems tome... or you should be able to find something online.

Cheers,

Timkin
Don''t perform the sqrt, test on the squared values
or use a LUT

If you need to calculate alot of square roots, then you can look into 3DNow!/SSE/SSE2 code.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
There is also a nice article on some float tricks in the GPG (one or two, not sure now).
Message was: get mantisa, get sqrt of mantisa from a table, modify proper with exponent.

you will get the sqrt with only some bit operations and a access to a table with like 4096 precalculated sqrts.

(Check the books, they are great)
-----The scheduled downtime is omitted cause of technical problems.

This topic is closed to new replies.

Advertisement