I am trying to find square root of 12345 and then scale it to 100 decimal places using the command shown below:
val=$(bc <<< "scale=100 ; sqrt ( 12345) " )
But the problem is I want to rescale the value to 10 decimal places using bc only in echo command but it is not working, I tried following code of lines but none worked.
echo "scale=10 ; "$val" " | bc echo "scale=10 ; $val " | bc echo "scale=10 ; val " | bc
Can somebody here help me and make out the difference.
Note: I don't want to directly scale the value to 10 places in sqrt() because last place of decimal value differ from the answer so to have high accuracy I have to do in this way.