Use `printf`:
$ printf "%.4f\
" "$A"
1.2346
$ printf "%.4f\
" "$B"
0.0000
$ printf "%.4e\
" "$B"
1.2346e-05
$ printf "%.14f\
" "$B"
0.00001234567800
$ printf "%.4g\
" "$B"
1.235e-05
$ printf "%.4g\
" "$A"
1.235
Since `%e` might change the exponent, to be sure of keeping it the same, you can use the shell's string manipulation features to separate the number from the exponent and print each separately:
$ B=100.12345678E-05
$ printf '%.5fE%s\
' "${B%E*}" "${B##*E}"
100.12346E-05
The `${B%E*}` prints everything up to the 1st `E` and `${B##*E}` is everything after the first `E`.