[Bug 206230] dc(1) bugs

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Dec 1 21:04:50 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206230

Alan Somers <asomers at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asomers at FreeBSD.org

--- Comment #1 from Alan Somers <asomers at FreeBSD.org> ---
The problem is simpler than you suggest.  It looks like fractional input
doesn't work correctly when the input base is 16.  Try this:

$ dc -xe 16i0.1p
0.0
$ dc -xe 16i0.8p
.5
$ dc -xe 16i0.4p
.2

The first and third results are wrong, and the second result is correct.  I get
the same results with both the FreeBSD and the GNU versions of both bc(1) and
dc(1).  I suspect the problem is that some number is being treated as an
integer in units of base^n for n < 0 _before_ conversion to a bignum.  That
would explain these three results, for n=-1.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list