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.

886 questions
20
votes
2 answers

Converting decimal(base 10) numbers to binary by repeatedly dividing by 2

A friend of mine had a homework assignment where he needed to convert decimal(base 10) numbers to binary. I helped him out and explained one of the ways I was taught to do this. The way I showed him was to repeatedly divide the number by 2 and then…
Hunter McMillen
  • 493
  • 2
  • 8
  • 16
19
votes
5 answers

Why don't we use base 6 or 11?

Another question on this site asks why we have chosen our number system to be decimal base 10. There are others asking basically the same thing as well. I'm not really satisfied with any of the answers, because most of the answers given seem to…
Michael
  • 311
  • 2
  • 4
  • 8
19
votes
10 answers

What is a real number (also rational, decimal, integer, natural, cardinal, ordinal...)?

In mathematics, there seem to be a lot of different types of numbers. What exactly are: Real numbers Integers Rational numbers Decimals Complex numbers Natural numbers Cardinals Ordinals And as workmad3 points out, some more advanced types of…
Chris S
  • 373
  • 6
  • 13
19
votes
3 answers

Are surreal numbers actually well-defined in ZFC?

Thinking about surreal numbers, I've now got doubts that they are actually well-defined in ZFC. Here's my reasoning: The first thing to notice is that the surreal numbers (assuming they are well defined, of course) form a proper class. Now, quoting…
celtschk
  • 41,315
  • 8
  • 68
  • 125
19
votes
1 answer

Multiplication of doubly-infinite decimal numbers

Edit: Since there has been a recent resurgence in activity, I may as well share what I have found. This construction for prime base p is seemingly equivalent to what is called a p-adic solenoid in the literature. I haven't still been able to find…
pregunton
  • 4,601
  • 1
  • 22
  • 50
19
votes
6 answers

What would base 0 be? How would/could it work?

If I was trying to take the number $123$ in base $10$ and try and convert it into base zero I would do something like this: $123 = 100 + 20 + 3$ $10^{\log_0(100)} + 10^{\log_0(20)} + 10^{\log_0(3)}$ But $\log_0(x)$ is the same thing as…
ZTqvhI5vpo
  • 916
  • 1
  • 6
  • 14
19
votes
4 answers

Are there any bases which represent all rationals in a finite number of digits?

In base 10, 1/3 cannot be represented in a finite number of digits. Examples exist in many other bases (notably base 2, as it's relevant to computing). I'm wondering: does there exist any base in which every rational number can be represented in a…
joshlf
  • 357
  • 2
  • 8
18
votes
5 answers

The sixth number system

In high school, I learned there are 5 number systems, namely: Natural numbers ($\Bbb N$) Integers ($\Bbb Z$) Rational numbers ($\Bbb Q$) Real numbers ($\Bbb R$) Complex numbers ($\Bbb C$) I remember one time our teacher told us that there is…
17
votes
4 answers

The Soup Problem: how to asymptotically fairly split a geometric series and a constant one using a single pattern?

Literally every time I'm serving some soup I'm thinking of this little mathematical problem I devised. Imagine you have a very large (= infinite, for the purposes of the actual problem) bowl of soup and want to divide it into two halves using a…
17
votes
11 answers

Why do we generally round 5's up instead of down?

As an example, the number 15, rounded to the nearest tens, rounds to 20. I understand it's arbitrary, as 10 and 20 are equidistant from 15, I just wonder if there's any discernible logic behind the convention of rounding up. Even something like, 'It…
ivan
  • 2,987
  • 6
  • 29
  • 34
17
votes
3 answers

How to convert $\pi$ to base 16?

According to this Wikipedia article $\pi$ is approximately 3.243F in base 16 (i.e. hexadecimal). Can someone explain this? (Note: I understand how to convert an integer to base 16) Thanks
16
votes
4 answers

What is fleventy five?

In an episode of "Silicon Valley", one of the characters goes on a rant about how smart he is and cut his teeth on 'hex tables', and he says, "ask me what F times 9 is. It's fleventy-five!" This is well documented, so I don't think I misheard…
JFA
  • 603
  • 3
  • 6
  • 16
16
votes
3 answers

How does quater-imaginary (and other imaginary/complex bases) work?

So I've been working on a simple base-conversion program, and having given it the ability to convert from decimal to any base $> 1$ or $< 0$, as well as the $p$-adic (bijective, I think?) bases, I decided to tackle imaginary systems. Unfortunately,…
Jef
  • 161
  • 1
  • 4
16
votes
2 answers

How to convert a fraction into ternary?

In a ternary system how is $\dfrac{1}{2}=0.\bar1$ ,$\dfrac{1}{3}=0.1=0.0\bar2$??, etc. In general, how does one write the ternary expression for a given fraction?
Ramana Venkata
  • 1,878
  • 2
  • 16
  • 24
14
votes
3 answers

Which base of numerical system have $\frac 15 = 0.33333\ldots$?

Which base of numerical system have $\frac{1}{5} = 0.33333\ldots$? I need assistance in solving this one.
Abby
  • 141
  • 3
1 2
3
59 60