diff options
Diffstat (limited to 'examples/functions/sqroot')
-rw-r--r-- | examples/functions/sqroot | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/examples/functions/sqroot b/examples/functions/sqroot deleted file mode 100644 index 79715cbf..00000000 --- a/examples/functions/sqroot +++ /dev/null @@ -1,21 +0,0 @@ -#From: Syamala Rao Tadigadapa <stadigad@us.oracle.com> -#Subject: Re: Division in ksh(getting the exact number) Please HELP -#Date: Mon, 25 Oct 1999 15:05:08 -0700 -#Message-ID: <3814D414.7B896084@us.oracle.com> - -#Here is how to calculate the (integer part of the) square root -#of a number in a much cleaner way. - -sqroot() -{ - let arg=$1 - let root=arg - while : - do - newroot=$(( (root+arg/root)/2 )) - (( newroot == root )) && { echo $root; return; } - let root=newroot - done -} - -sqroot "$@" |