bc Questions
1
Solved
I have 10 bit signed binary numbers. I know two shell / bash ways to convert them to decimals yet signedness is not recognized.
1111101010 should be converted to -22 and not 1002.
echo "ibase=2;o...
1
Solved
How to assign this result to a shell variable?
Input:
echo '1+1' | bc -l
Output:
2
Attempts:
(didn't work)
#!bin/sh
a=echo '1+1' | bc -l
echo $a
1
Solved
Short version:
I'm trying to get something like this to work in c using piping:
echo 3+5 | bc
Longer version:
Following simple instructions on pipes at http://beej.us/guide/bgipc/output/html/m...
2
Solved
I can't figure out why bc tool sometimes ignores the scale option.
Here is an example:
> echo 'scale=2; 2.777 - 1.4744' | bc
1.3026
Expected result is:
1.30
Additional information:
> ...
4
Solved
I've the following CSV file's:
2012-07-12 15:30:09; 353.2
2012-07-12 15:45:08; 347.4
2012-07-12 16:00:08; 197.6
2012-07-12 16:15:08; 308.2
2012-07-12 16:30:09; 352.6
What I want to do is modify ...
1
Solved
I need 'bc' to divide a number and give me not only the floor but also the remainder. For instance 'bc' gives me '2' if I do '5/2'. I'd really want something like '2.5'
Maybe this isn't even possi...
7
Solved
I have a problem with a character. I think it's a conversion problem between dos and unix.
I have a variable that is a float value.
When I print it with the echo command i get:
0.495959
B...
2
Solved
in my app I'm using the sha256 of the issuer Name (x509CertImpl.getIssuerDN().getName()) and the certificate serial number to uniquely identify a certificate, but now I have realized that other imp...
Kuhlmann asked 25/7, 2011 at 16:8
3
I'm reading about the idea of Bounded Contexts in DDD, and I'm starting to realize that I don't have a clear understanding of exactly what a Model looks like in practice. (I might not even know exa...
Hako asked 23/12, 2010 at 19:30
4
3
I have a calculation on a Linux shell, something like this
echo "scale=4;3*2.5" |bc
which gives me an result, now I like to pipe the result of this calculation into an Variable so that I...
2
Solved
Is there some way I could make decimal.Decimal the default type for all numerical values in Python? I would like to be able to use Python in a manner similar to the bc and dc programs without havin...
Boxfish asked 18/1, 2011 at 17:21
3
Solved
I'm trying to write a bash script and I needed to do some floating point math. Basically I want to do something like this:
NUM=$(echo "scale=25;$1/10" | bc)
if [ $? -ne 0 ]
then
echo bad
fi
The ...
© 2022 - 2024 — McMap. All rights reserved.