bc
1/2
0
5/3
1
10/3
3
When a fraction is entered into bc, the result is truncated to an integer. How can this behavior be avoided, such that the output of a division operation is a real number?
bc
1/2
0
5/3
1
10/3
3
When a fraction is entered into bc, the result is truncated to an integer. How can this behavior be avoided, such that the output of a division operation is a real number?
Just invoke bc with the -l argument:
bc -l
Example:
$ bc -l
1/2
.50000000000000000000
5/3
1.66666666666666666666
10/3
3.33333333333333333333