Program: RMssqrt.z80
Like the Game of NIM program, this is recent, but based on one I wrote for a Diehl programmable calculator, the first machine I ever programmed, back in 1973/4, that I've referred to elsewhere.
The user is prompted to enter a number and the program makes successive guesses at its square root, using the Newton-Raphson method, starting (arbitrarily) with 1, until these converge on a single result, at which point the program stops. Printing of these guesses can be suppressed and the final result printed instead, by making suitable edits following comments in the program, but I think it's fun to see the guesses converge. Also, the final line can be uncommented to display the result of using the Spectrum's square root function as well, for comparison.
I've tried to keep the spirit of the Diehl program, so there's no text prompt for input other than a '?' .
Unlike my experience with the Diehl program, the results won't oscillate between two values although the logic is the same (stop when successive guesses are equal).
Interestingly, in the above example, the last two guesses are the same. I would have expected the program to stop before printing the final result, so there seems to be some rounding going on under the covers.