Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2016 19:18:36 +0000 (UTC)
From:      Christian Weisgerber <naddy@mips.inka.de>
To:        freebsd-questions@freebsd.org
Subject:   Re: dc(1) bugs
Message-ID:  <slrnn9d8oc.d44.naddy@lorvorc.mips.inka.de>
References:  <0McVKy-1aajq60oIS-00Hgju@mail.gmx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-01-13, "CK" <nibbana@gmx.us> wrote:

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

Many of your examples are confusing because you stripped off leading
periods from the results.

Also, all your four cases seem to come down to the same problem,
so let's just pick one:

> #####
> 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

Simpler examples:

$ dc -e '50k 16i .1 p'
0.0
$ dc -e '50k 16i .10 p'
.06
$ dc -e '50k 16i .100 p'
.062
$ dc -e '50k 16i .1000 p'
.0625

I'll note that GNU dc(1) behaves the same way, so I think it is a
case of poorly documented or counter-intuitive behavior rather than
a bug.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?slrnn9d8oc.d44.naddy>