/usr/src/usr.bin/dc/ %dc -e "5 3 %p 1k 5 3 %p" 2 .2 Output of the modulo operator is divided by 10(scale) when scale>0. From what I tested the bug doesn't appear to happen in bcode.c:bmod(void), it looks like it happens some time after it is called. How-To-Repeat: %dc -e "5 3 %p 1k 5 3 %p" 2 .2
A commit references this bug: Author: asomers Date: Thu Dec 7 02:08:56 UTC 2017 New revision: 326652 URL: https://svnweb.freebsd.org/changeset/base/326652 Log: dc(1): fix modulo operations with fractional inputs Our dc(1) has never correctly calculated remainders with fractional inputs. Both bmod and bdivmod seem to have copy/pasted code from bdiv, which results in the remainder having the wrong output scale. PR: 162495 Reported by: anonymous Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D13390 Changes: head/usr.bin/dc/bcode.c head/usr.bin/dc/dc.1 head/usr.bin/dc/tests/Makefile head/usr.bin/dc/tests/bcode.sh head/usr.bin/dc/tests/inout.sh