Description
Compare signed-magnitude operands for opposing nonzero signs.
A fixed-width bit pattern and the number it represents are different concepts. Unsigned, two's-complement, one's-complement, sign-magnitude and biased encodings use different sign and zero conventions, so a bit-preserving transformation need not preserve numerical meaning.
Compare signed-magnitude operands for opposing nonzero signs.
When to use this tool
Use Signed Magnitude Add Sign Conflict when checking the stated fixed-width representation or encoding convention.
How to use the tool and how it works
- Enter leftSign, leftMagnitude, rightSign, rightMagnitude. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read conflict, cancel, dominantSign. Inspect conflict, cancel, dominantSign before interpreting the associated values.
Compare signed-magnitude operands for opposing nonzero signs. Parse nonnegative exact magnitude strings; conflict requires different sign flags and both magnitudes nonzero, cancel additionally equal magnitudes; dominantSign selects the larger magnitude's flag or false for equal magnitudes.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| leftSign | Left Sign | Required. Boolean. |
| leftMagnitude | Left Magnitude | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| rightSign | Right Sign | Required. Boolean. |
| rightMagnitude | Right Magnitude | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| conflict | Conflict | Required. Boolean. |
| cancel | Cancel | Required. Boolean. |
| dominantSign | False whenever magnitudes are equal, even if both supplied signs are negative; otherwise the larger magnitude's sign. | Required. Boolean. |
{
"input": {
"leftSign": true,
"leftMagnitude": "5",
"rightSign": false,
"rightMagnitude": "3"
},
"output": {
"conflict": true,
"cancel": false,
"dominantSign": true
}
} Limitations and assumptions
- Equal magnitudes return false even for equal sign flags; this is not a full addition result or an unambiguous sign when tied.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Choose an explicit representation and width, validate the complete encoded value and use the matching signed or unsigned conversion for the intended numerical interpretation.
References
Similar or alternative tools
- Bitwise: Sign Magnitude Signed Zero Tag
Return sign-magnitude sign, magnitude and negative-zero flags.
- Bitwise: Sign Magnitude Word To Integer
Decode a sign-magnitude word with negative-zero policy.