For instance : -78_base10 on 8 bits is 0xB2
The pseudo-algorithm says : “-A =/A+1”
For instance :
- -78 => 78 => 01001110
- Then apply ‘bar’ : 01001110 => 10110001
- Then ‘+1’ : 10110001 + 1 = 10110010
- convert in hexa : 0xB2
How to get the result nicely in Ruby (with or without this ‘algorithm’).
How about something like