Date: Wed, 3 Sep 2025 08:48:37 +0200
> On 2 Sep 2025, at 20:34, David Brown <david.brown_at_[hidden]> wrote:
>
> On 02/09/2025 18:58, Hans Åberg wrote:
>>> On 2 Sep 2025, at 18:36, David Brown <david.brown_at_[hidden]> wrote:
>>>
>> On a 1-bit modular arithmetic type, one should have 1+1=0. But I could not do that with the boolean types.
>
> I agree - on a 1-bit modular type, 1 + 1 should give 0. That is the case for unsigned _BitInt(1) in C23, as that is a 1-bit modular type.
Actually, the n-bit bitwise operators make an n-generator Boolean algebra. If also having int-style logical operators, for n = 1 they agree with the bitwise operators. So then for n = 1, one gets a type that unifies the bitwise, logical, and arithmetic operators.
>
> On 02/09/2025 18:58, Hans Åberg wrote:
>>> On 2 Sep 2025, at 18:36, David Brown <david.brown_at_[hidden]> wrote:
>>>
>> On a 1-bit modular arithmetic type, one should have 1+1=0. But I could not do that with the boolean types.
>
> I agree - on a 1-bit modular type, 1 + 1 should give 0. That is the case for unsigned _BitInt(1) in C23, as that is a 1-bit modular type.
Actually, the n-bit bitwise operators make an n-generator Boolean algebra. If also having int-style logical operators, for n = 1 they agree with the bitwise operators. So then for n = 1, one gets a type that unifies the bitwise, logical, and arithmetic operators.
Received on 2025-09-03 06:48:55