Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sin()
- {
- if [ $# != 2 ]
- then
- echo "FAIL" >&2
- return 2
- fi
- result=$1
- x=$1
- n=1
- fact=1
- for k in `seq 2 $2`
- do
- x=$(( $x * $1 * $1 ))
- n=$(( $n + 2 ))
- fact=$(( (-1.0) * $fact * ($n - 1) * $n ))
- result=$(( $result + $x / $fact ))
- done
- echo $result
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement