ExNumerlo

ExNumerlo is an Elixir library for rendering and parsing integers using various Unicode numeral systems. It supports 88 systems — from the modern positional scripts of South and Southeast Asia to ancient additive systems like Mayan and Kaktovik, and specialized mathematical and programmer bases.

Features

Installation

Add ex_numerlo to your list of dependencies in mix.exs:

def deps do
[
{:ex_numerlo, "~> 0.4.0"}
]
end

Documentation can be generated with ExDoc and published on HexDocs.

Usage

The sole public interface is ExNumerlo.convert/2, which handles encoding, decoding, and cross-system conversion.

Encoding Integers

To encode an integer (or a list of integers) into a specific numeral system:

ExNumerlo.convert(123, to: :devanagari)
# {:ok, "१२३"}
ExNumerlo.convert(2026, to: :roman)
# {:ok, "MMXXVI"}
ExNumerlo.convert([1, 2, 3], to: :roman)
# {:ok, ["I", "II", "III"]}

Decoding Strings

To decode an encoded string back to an integer, use the to: :integer option. You can specify the source system or let it be auto-detected:

# Explicit source
ExNumerlo.convert("१२३", from: :devanagari, to: :integer)
# {:ok, 123}
# Auto-detection
ExNumerlo.convert("MMXXVI", to: :integer)
# {:ok, 2026}

Cross-System Conversion

Convert directly between two numeral systems without going through an intermediate integer:

ExNumerlo.convert("MMXXVI", to: :egyptian)
# {:ok, "𓆼𓆼𓎆𓎆𓏺𓏺𓏺𓏺𓏺𓏺"}
ExNumerlo.convert("͵βκϛ", to: :roman)
# {:ok, "MMXXVI"}

Separator Support

Positional systems support custom separators for grouping:

ExNumerlo.convert(1234567, to: :arabic, separator: ",")
# {:ok, "1,234,567"}
ExNumerlo.convert("1.234.567", from: :arabic, to: :integer, separator: ".")
# {:ok, 1234567}

Supported Systems

The following 88 systems are currently supported. Examples show 123 (or a nearby value within each system's range); the range column notes supported inputs.

SystemKindDescriptionRangeExample
:adlamBase-10 digitsAdlam script numerals, used for the Fulani language in West Africa.any𞥑𞥒𞥓 (123)
:aegeanAdditive / sign-valueAegean numerals used by Minoan and Mycenaean civilizations (Linear A/B). Uses distinct glyphs for powers of 10 from 1 to 10,000.> 0𐄫𐄢𐄙𐄐𐄇 (11,111)
:arabicBase-10 digitsStandard Western Arabic numerals (0-9). The most widely used numeral system in the world today.any123 (123)
:arabic_abjadAdditive / sign-valueArabic abjad numerals, an alphabetic sign-value system assigning values to Arabic letters (alif=1 through ghayn=1000). Used historically for numbering and in Islamic numerology.> 0قكج (123)
:arabic_indicBase-10 digitsStandard Arabic-Indic numerals used in most of the Arab world.any١٢٣ (123)
:armenianLetter numeralsClassical Armenian alphabetic numerals using uppercase letters, from Ա (ayb=1) to Ք (kʿe=9000). Used in pre-modern Armenian manuscripts and dating.1–9999ՍԻԶ (2026)
:atticAdditive / sign-valueAncient Greek acrophonic system where symbols derive from the first letter of the number's name (e.g., Δ for δέκα/10).> 0ΔΔ𐅃ΙΙ (27)
:balineseBase-10 digitsBalinese script numerals, used for the Balinese language in Indonesia.any᭑᭒᭓ (123)
:base32ProgrammerBase-32 system using digits 0-9 and letters A-V.any3R (123)
:base36ProgrammerBase-36 system using digits 0-9 and letters A-Z.any3F (123)
:bengaliBase-10 digitsBengali-Assamese numerals used in Bangladesh and the Indian states of West Bengal and Assam.any১২৩ (123)
:binaryProgrammerBase-2 (binary) system using the standard digits 0 and 1.any1111011 (123)
:brahmiBase-10 digitsAncient Brahmi script decimal digits, the ancestor of most modern Indian and Southeast Asian numeral systems.> 0𑁧𑁨𑁩 (123)
:burmeseBase-10 digitsBurmese script numerals, used for the Burmese language in Myanmar.any၁၂၃ (123)
:chakmaBase-10 digitsChakma script numerals, used for the Chakma language in Bangladesh and India.any𑄷𑄸𑄹 (123)
:chamBase-10 digitsCham script numerals, used for the Cham language in Vietnam and Cambodia.any꫑꫒꫓ (123)
:cuneiformNon-decimalBabylonian sexagesimal (base-60) positional system using wedges. Values within each digit are additive.≥ 0𒁹 𒌋𒌋𒁹𒁹𒁹 (83)
:cyrillicLetter numeralsEarly Cyrillic numerals modeled on the Greek alphabetic system, with a myriad-style thousands marker (҂) preceding the unit letters. Used in Old Church Slavonic before Arabic numerals.1–9999҂ВКЅ (2026)
:devanagariBase-10 digitsNumerals used with the Devanagari script, common in India for Hindi, Marathi, and Sanskrit.any१२३ (123)
:duodecimalNon-decimalBase-12 system using Pitman's notation (↊ for 10, ↋ for 11). Often preferred by dozenalists for its divisibility.any↊↋ (131)
:egyptianAdditive / sign-valueAncient Egyptian hieroglyphic numerals. An additive base-10 (sign-value) system using distinct glyphs for powers of ten up to one million.> 0𓍢𓍢𓎆𓎆𓏺𓏺𓏺 (223)
:ethiopicHybridGe'ez hierarchical additive-multiplicative system using segments of 100. Used in Ethiopia and Eritrea.> 0፳፫፻፵፭ (2345)
:extended_arabic_indicBase-10 digitsEastern Arabic-Indic numerals used primarily for Persian and Urdu. Differs from Arabic-Indic for digits 4, 5, and 6.any۱۲۳ (123)
:fullwidthBase-10 digitsFixed-width (monospaced) forms of Arabic numerals used in CJK (Chinese, Japanese, Korean) contexts for visual alignment.any123 (123)
:greekLetter numeralsAncient Greek (Milesian/Ionian) alphabetic numerals assigning letters to 1-9, 10-90, and 100-900 (alpha=1, stigma=6, koppa=90, sampi=900), with the keraia marker (͵) before letters for thousands.1–9999͵βκϛ (2026)
:gujaratiBase-10 digitsGujarati script numerals, used for the Gujarati language in India.any૧૨૩ (123)
:gunjala_gondiBase-10 digitsGunjala Gondi script numerals, used for the Gondi language in India.any𑶡𑶢𑶣 (123)
:gurmukhiBase-10 digitsGurmukhi script numerals, used primarily for the Punjabi language in India.any੧੨੩ (123)
:hanHybridSimplified Chinese/Japanese (Han) hybrid numeral system. Multiplicative-additive using units of 10,000.any一万二千三百四十五 (12,345)
:han_positionalBase-10 digitsPositional use of Han numerals, common in modern contexts like dates.any二〇二六 (2026)
:hebrewLetter numeralsHebrew gematria numerals assigning letter values from א (alef=1) to ת (tav=400), with final letter forms for 500-900 (khaf, mem, nun, pe, tsadi).1–999קכג (123)
:hexadecimalProgrammerBase-16 (hexadecimal) system using digits 0-9 and letters A-F.any7B (123)
:javaneseBase-10 digitsJavanese script numerals, used for the Javanese language in Indonesia.any꧑꧒꧓ (123)
:kaktovikNon-decimalKaktovik Inupiaq numerals, a base-20 (vigesimal) system designed by Alaskan Iñupiat to represent their language's oral counting.≥ 0𝋆𝋀 (120)
:kannadaBase-10 digitsKannada script numerals, used for the Kannada language in India.any೧೨೩ (123)
:kayah_liBase-10 digitsKayah Li script numerals, used for the Kayah Li language in Myanmar.any꤁꤂꤃ (123)
:kharosthiAdditive / sign-valueKharosthi numerals (U+10A40+) from ancient Gandhara, with digits for 1-4 and signs for 10, 20, 100, and 1000 combined additively (e.g., 9 written as 4+4+1).> 0𐩆𐩅𐩂 (123)
:khmerBase-10 digitsKhmer script numerals, used for the Khmer language in Cambodia.any១២៣ (123)
:laoBase-10 digitsLao script numerals, used for the Lao language in Laos.any໑໒໓ (123)
:lepchaBase-10 digitsLepcha script numerals, used for the Lepcha language in Sikkim and Darjeeling.any᱁᱂᱃ (123)
:limbuBase-10 digitsLimbu script numerals, used for the Limbu language in Nepal and India.anyᥧᥨᥩ (123)
:malayalamBase-10 digitsMalayalam script numerals, used for the Malayalam language in India.any൧൨൩ (123)
:masaram_gondiBase-10 digitsMasaram Gondi script numerals, another script used for the Gondi language in India.any𑵑𑵒𑵓 (123)
:math_boldMathematicalMathematical bold serif digits. Used in mathematical notation to distinguish different types of variables.any𝟏𝟐𝟑 (123)
:math_double_struckMathematicalMathematical blackboard bold digits. Commonly used to represent sets like integers (ℤ) or naturals (ℕ).any𝟙𝟚𝟛 (123)
:math_monospaceMathematicalMathematical fixed-width digits used in specialized mathematical and technical contexts.any𝟷𝟸𝟹 (123)
:math_sansMathematicalMathematical sans-serif digits used for clean representation in mathematical expressions.any𝟣𝟤𝟥 (123)
:math_sans_boldMathematicalMathematical bold sans-serif digits used for emphasis in mathematical notation.any𝟭𝟮𝟯 (123)
:mayanNon-decimalVigesimal (base-20) positional system used by the Maya civilization. Uses a shell for zero, dots for 1, and bars for 5.≥ 0𝋡𝋠 (20)
:meetei_mayekBase-10 digitsMeetei Mayek script numerals, used for the Meiteilon (Manipuri) language in India.any꯱꯲꯳ (123)
:modiBase-10 digitsModi script numerals, historically used to write the Marathi language in India.any𑙑𑙒𑙓 (123)
:mongolianBase-10 digitsTraditional Mongolian script numerals, used in Inner Mongolia (China) and Mongolia.any᠑᠒᠓ (123)
:mroBase-10 digitsMro script numerals, used for the Mro language in Bangladesh and Myanmar.any𖩡𖩢𖩣 (123)
:n_koBase-10 digitsN'Ko script numerals, used for the Manding languages in West Africa.any߁߂߃ (123)
:nag_mundariBase-10 digitsNag Mundari script numerals, used for the Mundari language in India.any𞓱𞓲𞓳 (123)
:new_tai_lueBase-10 digitsNew Tai Lue script numerals, used for the Tai Lue language in China and Southeast Asia.any᧑᧒᧓ (123)
:nyiakeng_puachue_hmongBase-10 digitsNyiakeng Puachue Hmong script numerals, another script used for the Hmong language.any𞅁𞅂𞅃 (123)
:octalProgrammerBase-8 (octal) system using the standard digits 0-7.any173 (123)
:ol_chikiBase-10 digitsOl Chiki script numerals, used for the Santali language in India and Bangladesh.any᱑᱒᱓ (123)
:oriyaBase-10 digitsOriya (Odia) script numerals, used for the Odia language in India.any୧୨୩ (123)
:osmanyaBase-10 digitsOsmanya script numerals, an alphabetic script used for the Somali language in Somalia.any𐒡𐒢𐒣 (123)
:pahawh_hmongBase-10 digitsPahawh Hmong script numerals, used for the Hmong language in Laos and Thailand.any𖭑𖭒𖭓 (123)
:rodBase-10 digitsCounting rod numerals, an ancient positional system using vertical and horizontal strokes.any𝍠𝍩𝍢 (123)
:romanAdditive / sign-valueStandard Roman numerals using additive/subtractive notation. Limited to the range 1-3999 in standard Unicode representation.1–3999MMXXVI (2026)
:rumiAdditive / sign-valueRumi (Fez) numerals (U+10E60+), a distinct sign-value system historically used in North Africa (Morocco) for dates and financial reckoning.> 0𐹲𐹪𐹢 (123)
:saurashtraBase-10 digitsSaurashtra script numerals, used for the Saurashtra language in Southern India.any꣑꣒꣓ (123)
:sharadaBase-10 digitsSharada script numerals, an ancient script used in Kashmir.any𑇑𑇒𑇓 (123)
:sinhalaBase-10 digitsSinhala (Lith) script numerals, used primarily for the Sinhala language in Sri Lanka.any෧෨෩ (123)
:sinhala_archaicAdditive / sign-valueArchaic Sinhala numerals (U+111E0+), an additive sign-value system historically used in Sri Lanka before the modern Sinhala script digits.> 0𑇳𑇫𑇣 (123)
:siyaq_indicAdditive / sign-valueIndic Siyaq accounting numerals (U+1EC70+) used in Mughal-era India and Persia for documents and currency, with distinct glyphs per digit place up to ten-thousands.1–99999𞲍𞱻𞱶 (2026)
:siyaq_ottomanAdditive / sign-valueOttoman Siyaq accounting numerals (U+1ED00+) used in Ottoman Turkish financial documents, with distinct glyphs per digit place up to ten-thousands.1–99999𞴝𞴋𞴆 (2026)
:sora_sompengBase-10 digitsSora Sompeng script numerals, used for the Sora language in India.any𑃱𑃲𑃳 (123)
:sundaneseBase-10 digitsSundanese script numerals, used for the Sundanese language in Indonesia.any᮱᮲᮳ (123)
:suzhouBase-10 digitsSuzhou numerals (huama), a shorthand numeral system once common in Chinese markets.any〡〢〣 (123)
:tai_tham_horaBase-10 digitsTai Tham script numerals (Hora style), used for secular purposes in Northern Thailand and Laos.any᪑᪒᪓ (123)
:tai_tham_thamBase-10 digitsTai Tham script numerals (Tham style), used for religious purposes in Northern Thailand and Laos.any᪡᪢᪣ (123)
:takriBase-10 digitsTakri script numerals, used for various languages in the Western Himalayas.any𑛁𑛂𑛃 (123)
:tamilBase-10 digitsTamil script numerals, used for the Tamil language in India and Sri Lanka.any௧௨௩ (123)
:tamil_traditionalAdditive / sign-valueTraditional Tamil numerals combining unit digits (௧-௯) with distinct ten, hundred, and thousand signs (௰, ௱, ௲). The predecessor of the modern positional Tamil digits.> 0௱௰௰௩ (123)
:tangsaBase-10 digitsTangsa script numerals, used for the Tangsa language in India and Myanmar.any𖫁𖫂𖫃 (123)
:teluguBase-10 digitsTelugu script numerals, used for the Telugu language in India.any౧౨౩ (123)
:thaiBase-10 digitsThai script numerals, used alongside Western Arabic numerals in Thailand.any๑๒๓ (123)
:tibetanBase-10 digitsTibetan script numerals, used in Tibet and surrounding regions.any༡༢༣ (123)
:tirhutaBase-10 digitsTirhuta script numerals, used for the Maithili language in India and Nepal.any𑓑𑓒𑓓 (123)
:totoBase-10 digitsToto script numerals, used for the Toto language in India.any𞊑𞊒𞊓 (123)
:vaiBase-10 digitsVai script numerals, a syllabic script used for the Vai language in Liberia.any꘡꘢꘣ (123)
:wanchoBase-10 digitsWancho script numerals, used for the Wancho language in India.any𞋱𞋲𞋳 (123)
:warang_citiBase-10 digitsWarang Citi script numerals, used for the Ho language in India.any𑣡𑣢𑣣 (123)

LLM Agent Instructions

Usage rules for LLM agents are provided in usage-rules.md for integration with the usage_rules tool.