Created
October 10, 2013 05:57
-
-
Save rssh/6913699 to your computer and use it in GitHub Desktop.
example of getting square root in forth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: sqrt-closer (square guess -- square guess adjustment) 2dup / over - 2 / ; | |
: sqrt ( square -- root ) 1 begin sqrt-closer dup while + repeat drop nip ; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You probably need to leave a space either side of the brackets on the first line :)