Questions tagged [number-systems]

Representations of numeric values in decimal, binary, octal, hexadecimal, and other bases; one's-complement and two's-complement signed numbers; scientific notation; floating-point numbers in digital computers; history of number systems; nonstandard number systems; algorithms for arithmetic within specific number systems or for conversions between number systems.

Number systems provide systematic ways to write numeric values such as the (base-ten) numbers $289$ or $2.125$. Some questions with this tag involve algorithms for converting base-ten numbers to or from another number system; conversions between other number systems; algorithms to perform arithmetic (addition, subtraction, multiplication, etc.) within a specific number system without converting the operands to base ten; symbols for writing numbers in systems other than base ten; ancient number systems (such as Roman numerals) and the historical development of number systems; and specialized or unusual number systems.

A base-$b$ number system represents an integer as a sequence of digits, each of which is an integer such that $0 \leq d < b$. Ordinary decimal numbers are written in base ten; other well-known bases include binary (base $2$), octal (base $8$), and hexadecimal (base sixteen). Optionally, the base or radix, $b$, may be appended as a subscript. The value of such a numeric representation is

$${\left(d_m d_{m-1} \cdots d_2 d_1 d_0\right)}_b = d_m b^m + d_{m-1} b^{m-1} + \cdots + d_2 b^2 + d_1 b^1 + d_0 b^0.$$

For example, $21_{16} = 33_{10} = 41_8 = 100001_2$, representing the same value as hexadecimal, decimal, octal, and binary numbers, respectively. The factors $b^0$, $b^1$, $b^2$, and so forth are the place values of the digits. A base-$b$ number with a fractional part is written by appending a decimal point and digits with place values $b^{-1}$, $b^{-2}$, $b^{-3}$, and so forth; for example, $$101.011_2 = 1\cdot2^2 + 0\cdot2^1 + 1\cdot2^0 + 0\cdot2^{-1} + 1\cdot2^{-2} + 1\cdot2^{-3} = 4 + 1 + \frac14 + \frac18 = 5.375_{10}.$$

In a mixed-radix number system, such as the factorial number system, the ratio between the places value of two digits depends on their distances from the decimal point. A number system can have a negative radix, for example the negabinary number system, which has the radix $-2$.

Digital computing has raised interest in various other number systems. In an $n$-digit $b$'s-complement base-$b$ representation, the integer $-x$ is represented by $b^n - x$, whereas in a $(b-1)$'s complement representation, $-x$ is represented by $(b^n - 1) - x$. Computers often use two's-complement (or sometimes one's-complement) binary numbers.

Very large or small numbers can be written in scientific notation, for example $1.234 \times 10^9$. Floating-point numbers in digital computers, typically using the IEEE 754 standard, serve a similar purpose.

More esoteric number systems of interest in computer science include:

  • Balanced base-$b$ number systems, which use both positive and negative digit values. The balanced ternary (base $3$) system with digit values $\{-1,0,1\}$ is an example of this kind of number system.
  • Redundant base-$b$ systems, which allow more than $n$ values of each digit. There may be many ways to represent a given number in such a number system.
  • Residue number systems, in which each digit position is assigned a fixed modulus and the digit in that position is the remainder when the number's value is divided by that modulus.

Other possible numbering systems include the Fibonacci base system and systems using a non-integer radix such as the $\phi$ number system.

949 questions
2
votes
3 answers

When representing a base-n number in decimal ($\frac{x}{n^l}$), will there be a different set of terminating representable numbers than base-10?

Forgive me if I have set this up wrong, I haven't done proofs in a long time. I was thinking at lunch today what it would be like if we could write binary behind a decimal point. Imagine $$110.11 = 6.75$$ This made me think, are there numbers in…
2
votes
0 answers

Are there any numeral systems that start with 1x prefix?

I know that it is customary to prefix hexadecimal numbers with 0x. I came across this number 1X000008 and was wondering if it is hexadecimal or is it another numeral system? Are there any numeral systems that start with 1x prefix?
javaPlease42
  • 121
  • 5
2
votes
2 answers

which is the more accurate way of representing numbers?

When we consider calculations at tiniest of scales which number system would be more accurate, when we consider the binary number system( base 2) or the number system we generally use (base 10). The other way to say it would be if we consider a…
munish
  • 397
2
votes
5 answers

How can we count in base eleven?

We work in base 10. We know base 3 would count 1, 2, 10, 11, 12, 20. How would we count in base 11?
2
votes
0 answers

Is there any formal or scientific use for a base 7 numeral system?

This numeral system is utterly obscure, and seems to have no use at all anywhere. So, is there any formal or scientific use for a base $7$ numeral system anywhere?
2
votes
1 answer

Converting from one to another numeral system

In a book for C# I read that there is direct way to convert from binary to hexadecimal: convert to nibbles with leading zeros replace with the hexadecimal representation of the nibble The rule is divide the binary number into groups containing the…
Bakudan
  • 145
2
votes
2 answers

How can we represent $10$ in a decimal system?

This may sound like a silly question to begin with but I'm having problems finding a proper answer. The question is generally targeting numeral systems of any base, but for simplicity, I will demonstrate the problem on the representation of natural…
barak manos
  • 43,109
1
vote
1 answer

How do I efficiently budget for digits when converting from one base to another?

I'm trying to work out a formula that gives me the minimum number of digits required to express a number in a target radix (r2) knowing only the source radix (r1) and number of significant digits (d). I've been messing around with this for quite…
trw
  • 1,063
1
vote
4 answers

How to compute 1/7 in base 8?

This is probably a very basic question but nonetheless I choked when I got in a math for programmers class. I was taught how to convert from base to base but I have no idea how to convert fractions to decimals in bases other than base 10.
1
vote
1 answer

Conversion in Number system

Here I provide the image. My question is why is it necessary to have 2 different results of the same problem. Am I doing something wrong. Please Help! Thanks in advance.
1
vote
2 answers

Numerical System

This was my interview question in the question paper. please help me in finding the answer . " in a class of 100 students 24 of them are girls and 32 are not. Which numerical system base are we using here? ( Hint: Decimal system base is 10 and…
1
vote
4 answers

How to convert octal to decimal?

I tried to convert octal numbers to decimal numbers and I found the formula but I am expecting a different way. My way is: the octal is $547$. Formula: $(5*8^2)+(4*8^1)+(7*8^0)$ Answer: $355$ But I am expecting a different way. Since I want to…
1
vote
2 answers

Why 5.8 (decimal) is 101.11001100... (binary)?

I would like to know why 5.8, in decimal 101.11001100..., in binary, a recurring decimal?
richardaum
  • 279
  • 1
  • 3
  • 12
1
vote
1 answer

Problem in converting from hex to dec

I understand that unsigned representation does not have negative numbers but I am stuck with a question, I have to convert B which is a hex value to decimal and it is a unsigned representation. Now I am getting confused with, If it is an unsigned…
user2857
1
vote
3 answers

Help with natural number problems

Suppose that $\mathbb{F}$ is an ordered field with identities $0$ and $1^{\star}$ (in this problem, $1 \in \mathbb{N}$ ) Define inductively $f: \mathbb{N} \rightarrow \mathbb{F}$ by: $$f(1) = 1^{\star}\qquad f(n + 1) = f(n) +…
NasuSama
  • 3,364