[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nmh-workers] Ordinal Indicators.
From: |
Ralph Corderoy |
Subject: |
Re: [nmh-workers] Ordinal Indicators. |
Date: |
Mon, 08 Jul 2019 17:25:42 +0100 |
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.
- Re: [nmh-workers] Ordinal Indicators., (continued)
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Robert Elz, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ken Hornstein, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ken Hornstein, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Robert Elz, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ken Hornstein, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators.,
Ralph Corderoy <=
- Re: [nmh-workers] Ordinal Indicators., Ken Hornstein, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Valdis Klētnieks, 2019/07/08
- Re: [nmh-workers] Ordinal Indicators., Ralph Corderoy, 2019/07/09