T-n-T: Negative numbers

The problem

It is required to determine the modulus and sign of the number obtained, for example, by subtracting a larger number from a smaller number, for analysis and to perform the inverse transformation.

The solution

Highlighting the modulus and number sign.
Converting a module to a number, taking into account the sign:.

The solution allows, using 16-bit values available in CANNY controllers, to operate with signed numbers in the range from -32768 to 32767, using their representation in the so-called two’s complement code.

You may need to use such conversions to parse negative values and perform some arithmetic on them, such as division.