Comparing 16 bit Integer Square Root routines (SQRT)

Programming the 6502 microprocessor and its relatives in assembly and other languages.
TobyLobster
Posts: 37
Joined: 17 Jun 2021

Re: Comparing 16 bit Integer Square Root routines (SQRT)

Post by TobyLobster »

ilmenit wrote:
The code is on the MIT license so feel free to use it or add it to your benchmark.
Thanks. I had a go at optimising your routine (I hope that's ok), by calculating initial upper and lower bounds. This gives a smaller range to search. This improves the performance, but as it stands my sqrt10.a is still a little bit faster in general and smaller (no tables).

Here's the performance of my optimised version of your routine in red:
roots.png
ilmenit
Posts: 11
Joined: 23 Apr 2020

Re: Comparing 16 bit Integer Square Root routines (SQRT)

Post by ilmenit »

TobyLobster wrote:
This improves the performance, but as it stands my sqrt10.a is still a little bit faster in general and smaller (no tables).
Your procedure is amazing and I'm going to steal it for my project, if you don't mind :-)
TobyLobster
Posts: 37
Joined: 17 Jun 2021

Re: Comparing 16 bit Integer Square Root routines (SQRT)

Post by TobyLobster »

ilmenit wrote:
TobyLobster wrote:
This improves the performance, but as it stands my sqrt10.a is still a little bit faster in general and smaller (no tables).
Your procedure is amazing and I'm going to steal it for my project, if you don't mind :-)
No problem, go for it!
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Comparing 16 bit Integer Square Root routines (SQRT)

Post by barrym95838 »

After briefly struggling with the nuts and bolts, I have tentatively concluded that Bruce's subroutine is the likely destination for my attempts to "integerize" MJM's subroutine. The probability of me being able to out-golf Bruce is low enough to steer me toward spending my increasingly limited attention elsewhere, after congratulating everyone for an entertaining and informative thread. Cheers!
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)
Post Reply