# dc(1) bugs

CK nibbana at gmx.us
Wed Jan 13 04:22:50 UTC 2016

```FreeBSD-9.3 dc(1)

These appear to be bugs to me, but please verify if possible:

#####
FIRST
#####
\$ dc -xe '50k16o16i.1vp'
0
\$ dc -xe '50k10o16i.1vp'
0
\$ dc -xe '50k10o10i.1vp'
31622776601683793319988935444327185337195551393252

This should be telling dc(1):

a) scale is 50 (in decimal) digits.
b) output in base16, base10, and base10 respectively.
c) input will be in base16, base16, and base10 respectively.
d) take the square root, and print it to the display.

Of course, the 3rd example above is correct, but the first 2?  Why 0?

######
SECOND
######
\$ dc -xe '50k16o16i.4 2^p'
0A
\$ dc -xe '50k16o16i.0Avp'
2C572B0D5A1443EC508B9E24D8DF392750959EE138

This should be telling dc(1):

a) scale is 50 (in decimal) digits.
b) output in base16, input is now base16.
c) square "0.4", and print it to the display (result=0.0A).
d) take the square-root of "0.0A", and print it to the display.

Of course, the square-root of a squared number should result in
the orginal number.  But, this is not happening.

#####
THIRD
#####
\$ dc -xe '50k16o16i.4 2^p'
0A
\$ dc -xe '50k16o16i.40 2^p'
1000
\$ dc -xe '50k16o16i.400 2^p'
10000
\$ dc -xe '50k16o16i.4000 2^p'
1000000

dc(1) is supposed to be precise in the digits it calculates, but here?
Something is not right about these results, or so it appears to me.

######
FOURTH
######
\$ dc -xe '50k16o16i.1vp'
0
\$ dc -xe '50k16o16i.10vp'
3EB4F9D9B6D094C33D38373D38777A7D9233A1B0FB
\$ dc -xe '50k16o16i.100vp'