how can i find sqrt of a any number without using expr

hi friends
can any body tell me how can i find sqrt of a any given number without using expr in bash shell
while i am doing i got some errors please take a look
and code is here
x=$((( ( sqrt($1) ) | bc )))
echo $x

[srinivas@localhost shell-lab]$ sh quadratic-eqn-roots.sh 9
quadratic-eqn-roots.sh: line 12: ( ( sqrt(9) ) | bc ): missing `)' (error token is "(9) ) | bc )")

Heh, That expression is very problematic. Here's one that works. The first argument is a number, which becomes 0 if it's not provided or if it is less than 0. The second argument is the number of decimal places to output -- or 4 if not provided.

y=$1
scale=4
# Make sure input is a valid number.
test -n "$y" || y=0; test "$y" -ge 0 || y=0
# Make sure scale is some number
test -z "$2" || scale=$2
# calc square root via bc
{ echo "scale=$scale"; echo "sqrt($y)" ; } | bc

vow...great...thanks a lot....
:b:

you can also use awk

printf "4" | awk '{print sqrt($0)}' 

Thanks..... I was actually just looking for a simple solution to that!

echo "sqrt($var)" | bc -l" | read root

The bc in Linux exceeds standard: add a -l for all you non-Linux coders.

Ghostdog's solution is better, and can be made even simpler:

x=`awk "END{print sqrt($y)}" </dev/null`