Hi,
Is -42nd handled? IIRC we demand C99 so we know rounding is towards
zero. But C's remainder operator, ‘%’, returns the sign of the
dividend, unlike modulo. And then there's two's complement so INT_MIN
can't be made positive.
$ for a in ' -' ' '; do
> for b in ' -' ' '; do
> fmttest -raw \
> -format "%(num${a}42) /${b}10 = %(divide${b}10)\t%(num${a}42)
%%${b}10 = %(modulo${b}10)" ''
> done
> done
-42 / -10 = 4 -42 % -10 = -2
-42 / 10 = -4 -42 % 10 = -2
42 / -10 = -4 42 % -10 = 2
42 / 10 = 4 42 % 10 = 2
$
--
Cheers, Ralph.
--
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers