Skip to content

Instantly share code, notes, and snippets.

@jdriordan
Last active February 11, 2021 13:00
Show Gist options
  • Select an option

  • Save jdriordan/4a373e39f5a7ef1f900fc4d50b1ed20c to your computer and use it in GitHub Desktop.

Select an option

Save jdriordan/4a373e39f5a7ef1f900fc4d50b1ed20c to your computer and use it in GitHub Desktop.
Nearest-integer square root in Forth
!# /usr/bin/gforth
: sq dup * ;
: is_sqrt? over sq - >= ;
: sqrt 1 begin 1+ 2dup swap is_sqrt? until ;
." Hello World" cr
bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment