dc is an arbitrary (bignum) precision desc calculator.
Questions tagged [dc]
9 questions
13
votes
3 answers
Losing precision with dc
I want to use dc to handle some base 16 numbers with hexadecimal points but I'm running into precision problems. For example, below I'm multiplying F423F.FD by 100, both hex. The expected answer is F423FFD, instead it is giving F423FFA.E1, close but…

Yimin Rong
- 923
2
votes
2 answers
How come dc print splits up long number
When running the dc utility, if I input a very large number, say:
999999999999999999999999999999999999999999999999999999999999999999999999
When I print it out using p, I…

MarksCode
- 135
2
votes
1 answer
How to get the difference between numbers using dc?
Input:
> printf 1\n\2\n3\n
1
2
3
Desired output:
0
1
1
Typing printf 1\n\2\n3\n | dc -e '-p' the output is:
dc: stack empty
dc: stack empty

ncomputers
- 1,524
- 1
- 11
- 23
0
votes
1 answer
executing 2 scripts with connection
I've been given some challenge: there is an application that provides me some postfix expression and expects to get a solution within 5 seconds.
If there is no solution, it quits, otherwise, it provides additional expression.
The interface is like…

user1977050
- 409
- 7
- 18
0
votes
1 answer
How can I supress GNU dc warnings?
When some invalid or undefined commands are executed in dc, it usually just prints a warning. Example:
cp
dc: stack empty
This is nice most of the time, however, there are cases where this is annoying as the desired action actually works. Consider…