Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::--------------------------------------------------------------------------------------------------
- :: Square root a number
- ::
- :: call :sqrt 144
- :: call :sqrt 144 return_var
- ::
- ::--------------------------------------------------------------------------------------------------
- :sqrt
- setlocal
- set "s=%~1"
- set /A "x=s/(11*1024)+40,x=(s/x+x)>>1,x=(s/x+x)>>1,x=(s/x+x)>>1,x=(s/x+x)>>1,x=(s/x+x)>>1,x+=(s-x*x)>>31
- (endlocal
- if "%~2" neq "" ( set %~2=%x% ) else echo %x%
- )
- goto :eof
- ::--------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement