Methods
decode(s) → {number}
Decodes the ELEN-encoded textual representation of a number back into the
original number. See #encode().
Parameters:
Name | Type | Description |
---|---|---|
s |
string | ELEN-encoded number |
Throws:
Error
Returns:
- Type
- number
encode(n) → {string}
Encodes a number as a string using ELEN encoding.
ELEN encoding provides a way of representing numbers such that their natural order is preserved as a lexicographical order i.e. alphabetical order) of their representations. Based on the algorithm for efficient lexicographic encoding of natural numbers by Peter Seymour.
ELEN encoding provides a way of representing numbers such that their natural order is preserved as a lexicographical order i.e. alphabetical order) of their representations. Based on the algorithm for efficient lexicographic encoding of natural numbers by Peter Seymour.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | Number to encode |
Throws:
Error
Returns:
- Type
- string