#!/bin/bash
#
# $1 = K
# $2 = tolerance
#

unalias rm
rm -fr V M
touch V M


declare -i i
i=1

for val in $( cat ApproxK$1T$2 )
do
if [ $i -eq 1 ]
then
echo $val >> V
i=2
else
echo $val >> M
i=1
fi
done



rm -fr temp
paste -d" "  V AccurateK$1T$2 > temp


declare -i j
declare -i a
declare -i b

j=0
x=0.0
y=0.0
rm -fr GVK$1T$2 GMK$1T$2
touch GVK$1T$2 GMK$1T$2

########################  for V
for q in $(cat temp)
do
if [ $j -eq 0 ]
then
a=$q
j=1
else
b=$q
j=2
fi
if [ $j -eq 2 ]
then
a=$a*100
x=`echo $a/$b | bc`
echo $x >> GVK$1T$2
j=0
fi
done

########################  for M
for q in $(cat M)
do
y=`echo $q*10 | bc`
echo $y >> GMK$1T$2
done


rm -fr temp M V 


#
#
#
#
#
#
#
#
#
#

