Skip to content

AdicNumerals ​

The first prec bb-adic digits, always fixed-width: the sign is folded into the digits rather than a sign bit, giving a bijection between (−bprec/2,bprec/2](-b^{prec}/2, b^{prec}/2] and width-prec digit strings.

AdicNumerals(b, prec?)the system, width prec (default 20)
Typed signatures
TypePackageApplies
(integer, integer?) -> valuenumeralsalways

Domain: Numeral systems

Examples

Basic #

Width-6 digits, most significant first: leading zeros pad

live ↗
InIntegerDigits(1 234,AdicNumerals(10,6))\mathrm{IntegerDigits}(1\,234, \mathrm{AdicNumerals}(10, 6))Out[0,0,1,2,3,4]\bigl\lbrack0, 0, 1, 2, 3, 4\bigr\rbrack

The sign is folded into the digits: −1-1 is all ones in base 2

live ↗
InIntegerDigits(−1,AdicNumerals(2,6))\mathrm{IntegerDigits}(-1, \mathrm{AdicNumerals}(2, 6))Out[1,1,1,1,1,1]\bigl\lbrack1, 1, 1, 1, 1, 1\bigr\rbrack
Scope #

−7≡9993(mod104)-7 \equiv 9993 \pmod{10^4}

live ↗
InIntegerDigits(−7,AdicNumerals(10,4))\mathrm{IntegerDigits}(-7, \mathrm{AdicNumerals}(10, 4))Out[9,9,9,3]\bigl\lbrack9, 9, 9, 3\bigr\rbrack
About
Examples3

See also: IntegerDigits, AdicNumeral, AdicExpansion