Tool to convert and calculate numbers in base -10, also called negadecimal base (positional numeral system in base minus ten)
Negadecimal - dCode
Tag(s) : Arithmetics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The negadecimal system is the name given to the positional numeral system in base $ -10 $ (negative/minus ten radix).
For every number $ N $ written in radix $ -10 $ and made of digits $ a_n, a_{n-1}, \cdots, a_1, a_0 $ then $$ N = \sum_{i=0} a_i \times (-10)^i $$ or the following calculation: $ N = a_n(-10)^n + \cdots + a_1(-10)^1 + a_0(-10)^0 $
To change the base from a decimal number (base 10) to negadecimal (base -10), apply the algorithm:
N = []
While (n != 0) {
r = n % (-10)
n = floor( n / (-10) )
if (r < 0) {
n += 1
r += 10
}
N = [r,N]
}
Example: $ 123_{(10)} $ go througn the steps: $ r = 123 % (-10) = -7 $, $ n = \lfloor 123/(-10) \rfloor = -13 $ as $ r < 0 $, $ n = -12 $ and $ r = -7 + 10 = 3 $ so the last digit is $ 3 $. Continue to get $ 823_{(-10)} $
To calculate the decimal value of a number in radix -10, apply the formula: $$ N = \sum_{i=0} a_i \times (-10)^i $$ with $ a_i $ the digits of $ N $.
Example: $ 789_{(-10)} = 7 \times (-10)^2 + 8 \times (-10)^1 + 9 \times (-10)^0 = 7 \times 100 + 8 \times (-10) + 9 = 629_{(10)} $
Negadecimal has the advantage of being able to store negative numbers without a minus - sign.
dCode retains ownership of the "Negadecimal" source code. Except explicit open source licence (indicated Creative Commons / free), the "Negadecimal" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Negadecimal" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Negadecimal" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.
The copy-paste of the page "Negadecimal" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Negadecimal on dCode.fr [online website], retrieved on 2024-11-05,