Expand description
Base conversion between integers and digit vectors (most significant
first): BASE, and the 10-digit two’s complement of DEC2BIN / BIN2DEC
and the rest of the radix 2 / 8 / 16 family.
Functions§
- decode
- The integer 10-digit two’s-complement digits
dsin radix 2, 8 or 16 stand for (decode_spec):Nonefor more than 10 digits or a digit not belowr. - encode
vas 10-digit two’s complement in radix 2, 8 or 16:Noneexactly whenvis outside[−r¹⁰/2, r¹⁰/2). The digits are those ofv(v + r¹⁰if negative) without leading zeros: at most 10, each belowr, exactly 10 for a negativev, anddecodemaps them back tov.- round_
trip - The round trip, as one statement: for every
vin range,encodesucceeds anddecodeof its digits givesvback. - to_
digits uin radixr(2…36): its digits, most significant first, without leading zeros (0is one digit). Each digit is belowrand they are worth exactlyu.