Bash - Math: Returns integer instead of float
try something like this
$ echo "21/5" | bc -l
4.20000000000000000000
$ echo "$y * ($num_lines/$w)" |bc -l
37.80000000000000000000
For setting up limit of decimal point use like below, For 2 decimal point
$echo "scale=2; $y * ($num_lines/$w)" | bc -l
37.80
For 3 decimal point, just change the scale number.
$ echo "scale=3; $y * ($num_lines/$w)" | bc -l
37.800