On Tuesday, 25 November 2014 at 07:39:44 UTC, Don wrote:
No, that is not overflow. That is a carry. Overflow is when the sign bit changes.

I think this discussion will be less confusing with clearing up the terminology.

An overflow condition happens when the representation cannot hold the magnitude of the intended type. In floating point that is +Inf and -Inf.

And underflow condition happens when the representation cannot represent the precision of small numbers. In floating point that is +0, -0 and denormal numbers, detected or undetected.

Carry is an extra bit that can be considered part of the computation for a concrete machine code instruction that provides carry. Eg 32bits + 32bits => (32+1) bits.

If the intended type is true Reals and the representation is integer then we get:

0u - 1u => overflow
1u / 2u => underflow

Carry can be taken as an overflow condition, but it is not proper overflow if you interpret it as s part of the result that depends on the machine language instruction and use of it. For a regular ADD/SUB instruction with carry the ALU covers two intended types (signed/unsigned) and use the control register flags in a way which let's the programmer make the interpretation.

Some SIMD instructions does not provide control register flags and are therefore true modular arithmetic that does not overflow by definition, but if you use them for representing a non-modular intended type then you get undetected overflow…

Overflow is in relation to an interpretation: the intended type versus the internal representation and the concrete machine language instruction.

Reply via email to