On Sunday, 31 May 2026 at 23:53:27 UTC, Dom Disc wrote:
-byte.min == byte.min (twos complement - also the same result as if the int-value 128 is truncated to signed eight bit), so yes, this should be allowed.

You are talking about bit patterns. VRP is to determine a number range.

-byte.min = 128
byte.min = -128

VRP correctly sees that those two values are not the same.

 -x should always have same type as x.

Not necessarily, doing that is more bug-prone.

But I would prefer that T.min is NaN of signed types. Instead byte.min should be -127 (or general T.min == -T.max). This would also fix abs().

The hardware does not treat T.min as NaN, so that is a no-go.
      • Re: Ope... Meta via Digitalmars-d-learn
        • Re:... Dom Disc via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... Nick Treleaven via Digitalmars-d-learn
          • ... Meta via Digitalmars-d-learn
            • ... Nick Treleaven via Digitalmars-d-learn
            • ... Dom Disc via Digitalmars-d-learn
            • ... Andy Valencia via Digitalmars-d-learn
            • ... Nick Treleaven via Digitalmars-d-learn
            • ... Dom Disc via Digitalmars-d-learn
            • ... Nick Treleaven via Digitalmars-d-learn
  • Re: Operator dec... Dom Disc via Digitalmars-d-learn

Reply via email to