If available/acceptable, using a pure bash solution with version 5.3 with the loadable builtin fltexpr and the new form of Command Substitution , and bash builtin printf with the -v option/flag
#!/usr/bin/env bash
enable fltexpr || exit
var=2
result=12345
LC_NUMERIC=C printf -v float '%.*f' "$var" "${ fltexpr -p "$result / 1000"; }"
echo "$float"
Or
#!/usr/bin/env bash
enable fltexpr || exit
var=2
result=12345
echo "${| LC_NUMERIC=C printf -v REPLY '%.*f' "$var" "${ fltexpr -p "$result / 1000"; }"; }"
Both should print/output
12.35
According to help fltexpr
fltexpr: fltexpr [-p] expression
Evaluate floating-point arithmetic expression.
Evaluate EXPRESSION as a floating-point arithmetic expression and,
if the -p option is supplied, print the value to the standard output.
Exit Status:
If the EXPRESSION evaluates to 0, the return status is 1; 0 otherwise.
According to help printf
printf: printf [-v var] format [arguments]
Formats and prints ARGUMENTS under control of the FORMAT.
Options:
-v var assign the output to shell variable VAR rather than
display it on the standard output
FORMAT is a character string which contains three types of objects: plain
characters, which are simply copied to standard output; character escape
sequences, which are converted and copied to the standard output; and
format specifications, each of which causes printing of the next successive
argument.
In addition to the standard format characters csndiouxXeEfFgGaA described
in printf(3), printf interprets:
%b expand backslash escape sequences in the corresponding argument
%q quote the argument in a way that can be reused as shell input
%Q like %q, but apply any precision to the unquoted argument before
quoting
%(fmt)T output the date-time string resulting from using FMT as a format
string for strftime(3)
The format is re-used as necessary to consume all of the arguments. If
there are fewer arguments than the format requires, extra format
specifications behave as if a zero value or null string, as appropriate,
had been supplied.
Exit Status:
Returns success unless an invalid option is given or a write or assignment
error occurs.
As per Léa Gris , added the LC_NUMERIC=C since it is affected by the systems locale