gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Anyone played with Logarithmic Number Systems?

#46603 - grumpycat - Mon Jun 27, 2005 10:37 pm

The Logarithmic Number System is an alternative representation of real numbers (alternative to floating point representation).

In LNS arithmetic multiplication and division become addition and subtraction. Squares and square roots become left and right shifts. Addition and subtraction are slightly complicated and require look-up tables.

In my "Thrust" game there were a lot of multiply, divide and square-root ops, but back then I hadn't discovered LNS.

I wonder if anyone here has played with LNS algorithms and, if so, what are your thoughts on its applicability to GBA games?


As an aside, I have been using fixed point numbers for going on 20 years now - they're perfectly fine, but I am intrigued by essentially "free" divides and square roots provided by LNS.


Grumpy.

#46614 - Miked0801 - Tue Jun 28, 2005 2:19 am

Round-off. Logarithms tables by nature have a lot of round-off - much more so than fixed-point. I've thought about this a bit as well and this way by conculsion from experiments. The addition and subtraction part doesn't help either :)