# What is the standardized way to represent $\pi$ in binary notation?

How do I best represent the number $\pi$ in binary?

I have been thinking about it for sometime and, if it was me, I would use four bits for each digit, because four bits are sufficient to represent 10-based digits. Something like:

0011 , 0001 0100 0001 ...


I wouldn’t know, also, how to represent the decimal point here.

I hope my question is clear enough.

# Update

I will put this into context. I didn’t want to, because I thought you would find it stupid.

I want to make a full back tattoo, representing pi in binary so, what I am looking for is a way that will be more or less simple to scale, as I will want thousands of digits, and I want it to be precise.

#### Solutions Collecting From Web of "What is the standardized way to represent $\pi$ in binary notation?"

What you’re suggesting is known as binary coded decimal representation. It is used by some simple calculators, and used to be commonly used in financial computing, because it can represent dollar amounts without rounding the cents (and also makes it easier to produce decimal output for human consumption). But it is harder to calculate with than true binary representation, which for $\pi$ is

11.0010010000111111011010101000100010000101101000110...


as found here. Here each bit after the point represents successively $1/2$, $1/4$, $1/8$, $1/16$, …, $2^{-n}$, …, so according to this representation
$$\pi = 2+1+1/8+1/64+1/2048+1/4096+\cdots$$

In practical computing, irrational numbers are nowadays almost always represented in binary, rounded to a fixed number of significant binary digits and then represented in a binary variant of scientific notation. There’s a widely-used standard for how to do this, IEEE-754, which allows different programs or systems to exchange floating-point values without first converting them to decimal notation. (A recent update of the standard defines more format, but is not as widely adopted).

Representing any real number in binary (or any base) is just the same principle as representing numbers in decimal.

For example, in decimal
$\frac{25}{8} = 3.125 = 3\cdot 10^0 + 1\cdot 10^{-1} + 2\cdot 10^{-2} + 5\cdot 10^{-3}$.

Now to write the same number in binary, first express it as a sum of powers of $2$ (this is exactly what you do when writing natural numbers in binary):

$\frac{25}{8} = 2 + 1 + \frac{1}{8} = 2\cdot 2^1 + 1\cdot 2^0 + 0\cdot 2^{-1} + 0\cdot 2^{-2} + 1\cdot 2^{-3} = 11.001_2.$

Any series of bytes can be represented in binary. You might as well encode Pi in bytes first, and then represent those bytes in binary.

If you use a “pure” binary format like described above, you’d need to write “,” which is not a valid binary digit.

File formats (series of bytes) are standardized unlike ad-hoc improvisations of binary encoding.

So what I’d suggest is: get hold of the B-file (a standardized format) of OEIS A000796 (B-file available here). Now you have your bytes. Now convert the bytes into an ASCII representation of binary digits.

Python 3:

>>> import urllib.request

Beware that the generated string (from bin) will start 0b.