The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
89 views

Why is `bc` ignoring my `obase`?

>>> bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. ibase = 16 obase = 56 ...
1
vote
2answers
717 views

Division with bc (bench calculator)

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 ...
0
votes
1answer
457 views

Best floating point solution for bash script?

I use bash calculator for floating point calculations and I have to use input redirection and backtick (`) symbol in scripts. As normal bracket $[math operation] and expr doesn't support float ...
1
vote
1answer
111 views

Multiplication in bc (bench calculator)

$ echo 2*1024|bc 20480 $ echo 2.0*1024|bc 2048.0 $ echo 2*1024.0|bc 2048.0 What's going on here then? Update: dc manages fine $ echo "2 1024 * p"|dc 2048
3
votes
4answers
1k views

Dividing with Gnu's bc

I'm just starting with Gnu's bc and I'm stuck at the very beginning (very discouraging...). I want to divide two numbers and get a float as result: $bc bc 1.06.94 Copyright 1991-1994, 1997, 1998, ...
3
votes
3answers
4k views

GNU BC: “modulo” % with scale other than 0

If the scale is other than zero, calculations with %, such as 3%2 and 46%4, tend to output 0. How is the algorithm designed with the scale other than 0? bc scale=10 print 4%3 // output 0