Questions tagged [dc]

dc is an arbitrary precision calculator which reads instructions from standard input or files.

A reverse-polish calculator stores numbers on a stack. Entering a number pushes it on the stack. Arithmetic operations pop 1 to 3 arguments off the stack, depending on the operation, and push the results back onto the stack.

Links

See also

  • (An arbitrary precision calculator)
42 questions
0
votes
1 answer

Linux tool dc gives "stack underflow" error

I'm trying to calculate a floating number via shell. When I execute the following line, the dc tool fails. dc -e "4000 0.531 / p" First, I was thinking that the problem was related to the floating precision. Then, I tried to change the divider with…
Caglayan DOKME
  • 948
  • 8
  • 21
0
votes
1 answer

Address attribute in with xpath (dublin core)

I have the following XML-response(s) via SRU in dublin core (of which there are several, this is one example): Die EU im Einsatz gegen den Klimawandel : der EU-Emissionshandel - ein offenes System, das weltweit Innovationen fördert /…
ssp24
  • 121
  • 1
  • 8
0
votes
3 answers

bash + how to verify if number ( float or integer ) is less then integer number 1

my task is to verify if $VAL NUMBER could be float or integer , is less then number 1 I did val=0.999 [[ $val -lt 1 ]] && echo less then 1 -bash: [[: 0.999: syntax error: invalid arithmetic operator (error token is ".999") what is the right way to…
Judy
  • 1,595
  • 6
  • 19
  • 41
0
votes
1 answer

How do I print the "zero" between the minus and the decimal places on Bash shell

With dc external tool bash tend to not print at the right of the decimal point. #!/bin/bash a[0]=-0.5 `echo "scale=10;${a[0]}/1"|bc -l` With the command represented above bash will print -.5000000000. How can I add the zero between the…
0
votes
1 answer

Python, FFT and DC offset analysis

I test an FFT on a square signal (100Hz, 0V-5V) of 50% duty cycle and i don't understand why my DC offset is huge ? In theory it should be 2.5V ? Thanks, Best regards. The fundamental is ok and others harmonics are correct. square signal 100Hz, TTL…
Vincent
  • 101
  • 3
0
votes
1 answer

Brushed DC motor with CANbus motor controller and ROS

I am rebuilding a mobile robot platform. I have brushed DC motors 12VDC, Peak Current 16.9A, No-load current of 0.33A and trying to fing a motor driver. Communication should be through CANbus. This is the driver that I found LINK. Questions…
0
votes
1 answer

Error printing a second time in Wxpython in python

I have a problem, but this time it has more relationship with Wxpython than with Tkinter. I don't usually use this module, so I know very little about it. In the following code, pressing the Enter key in the Tkinter test window will open the windows…
Dante S.
  • 222
  • 3
  • 16
0
votes
0 answers

dc input base must be a number between 2 and 16 inclusive

Called with ./dice.sh 1 1 1 1 I get dc input base must be a number between 2 and 16 inclusive vim dice.sh dice=0$(echo $* | tr -d [:space:] | tr 1-6 0-5) eval "hex=$(dc -e 16o6i${dice}p)" # Print the last 64 hex digits of the output: echo $hex |…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
0
votes
2 answers

how do I convert fractional decimal numbers to fractional binary numbers using dc

So dc is a great tool for converting between bases - handy for those bit twiddling coding jobs. e.g to convert 1078 into binary I can do this: bash> echo "2o1078p" | dc 10000110110 However I can't get it to print fractions between 0 and 1…
Michael Anderson
  • 70,661
  • 7
  • 134
  • 187
0
votes
2 answers

Implement the Unix 'dc' utility in C

I am just hoping on getting some tips on how to get started on my assignment. It reads as follows: "Implement a program that behaves similarly to the 'dc' utility, which evaluates expressions in a postfix notation, and also supports additional…
tbogatchev
  • 1,531
  • 3
  • 14
  • 21
0
votes
3 answers

How to convert a large number to base 36 using DC or other

I am trying to represent the maximum 64-bit unsigned value in different bases. For base 2 (binary) it would be 64 1's: 1111111111111111111111111111111111111111111111111111111111111111 For base 16 (hex) it would be 16 F's …
Lakey
  • 1,948
  • 2
  • 17
  • 28
-2
votes
2 answers

How to add a cooldown on discord.js?

I don't know how to add cooldown in discord.js but only for 1 command, for example : /buy count: 100, if user call the command again will activate the cooldown, 'sorry you have to wait 5minute to execute this command again' Can you help me to make a…
Hehehehaw
  • 1
  • 1
1 2
3