The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
72 views

How to install and run bc in Windows 10 properly?

I have installed the bc with the setup program. After I clicked the bc icon under the GNUWin32/bin, the bc.exe began to run. But when I ran the program, an error bc: command not found occurred. Same ...
0
votes
1answer
34 views

How to tell bash to repeat a script until satisfactory, then output the finished product

I'm looking to repeat this code until I stop it, either by setting a time for which it repeats, pressing ^c, or set number of iterations, and then output the result of repeating it. The code should ...
0
votes
1answer
29 views

Substarct two float numbers in shell script

I have written shell script to substract two float values For eg. below are the two values : debit_amount=7.853117806000353E7 credit_amount=3223649.619999993 val1=$(printf "%f", "$debit_amount") ...
0
votes
1answer
46 views

Particular bash bc usage not storing result in variable

Unfortunately this result in a empty variable, and bc command print its result to terminal anyway while trying to attribute to aux aux=&(bc -l <<< "scale = 5; c(${arguments[0]}*$constant)...
1
vote
2answers
67 views

Wrong results when comparing two numbers with bc (bash)

I’ve encountered an error, probably a bug in bc. I encountered it when trying to compare two numbers on a script in bash. It turns out that when I do: echo "1.1E-2<1.1E-1" | bc -l It returns 1 (...
1
vote
1answer
90 views

Get GNU bc to print a newline character

GNU bc is very unconventional. I can't find anything online about how to get it to print a newline character. I'm trying to get it to print the first 16 hexadecimal digits of the sines of the integers ...
2
votes
1answer
111 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 ...
2
votes
2answers
1k 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
592 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
113 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
4
votes
4answers
2k 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, ...
4
votes
3answers
8k 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