Would like to know if there is a sqrt algorithm - word, no floating point in assembly. I dont want use the C library function. The execution time of less than 150uS at 16MHz clock
The enclosed assembly sqrt subroutine computes the square root of word and return the nearest word (floating number not supported). Just extract the assembly code between the 2 pragma in this C file and you should be all set.
Cosmic sqrt function computes the square root of a double variable, returning the nearest double floating value. The problem is the execution time : ~1.55ms.
Do you also have sqrt algorithm in assembly that supports doubles instead of words and get faster result ? Breizh
I don't have better than the Cosmic one regarding double. If an integer variable sqrt algorithm is fine with you, I also have a sqrt long no floating point in assembly language. Both sqrt word and sqrt long have been included in this new attachment.
I just got better result with the latest sqrt functions from Cosmic : isqrt (word) and lsqrt (long).
At Fcpu = 8MHz using their modm model, I have : Execution time word = from 17us to 34us Execution time long = from ~22us to 57us (result depends on the input parameter value) It looks like this Cosmic subroutine is the best we have so far. Take care, Jojo