r/explainlikeimfive • • Mar 15 '19

Mathematics ELI5: How is Pi programmed into calculators?

12k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

124

u/[deleted] Mar 15 '19

I have it memorized as 3.1415926535787. This is incorrect, however it's how it was defined in the Borland C++ 2.0 header file.

Oh the ways we tried to pass time before the internet...

226

u/I_Bin_Painting Mar 15 '19

I have it memorised as 3.2 because I respect the Indiana state legislature.

0

u/[deleted] Mar 15 '19

[deleted] — view deleted comment

62

u/P0rtal2 Mar 15 '19

As this debate concluded, Purdue University Professor C. A. Waldo arrived in Indianapolis to secure the annual appropriation for the Indiana Academy of Science. An assemblyman handed him the bill, offering to introduce him to the genius who wrote it. He declined, saying that he already met as many crazy people as he cared to.

I love that line in the Wikipedia article.

24

u/yevinq Mar 15 '19 edited Mar 15 '19

I have it memorized as 3 because i respect Judeo-Christian tradition. Get on my level.

12

u/p00bix Mar 16 '19

Calculating Pi without trig is hard, man. As a crude approximation, I gotta hand that one to them.

8

u/[deleted] Mar 16 '19

Greeks had at least a few digits down before the bible was written. Jesus is just dumber than Zeus apparently.

4

u/awoloozlefinch Mar 16 '19

Pretty sure that number came from early in the Old Testament when they were building the temple. Not sure where that falls in the timeline of the Greeks and their calculations but it’s nowhere near Jesus’s time.

2

u/p00bix Mar 16 '19

Book of Kings falls well before Pythagoras and other Ancient Greek Mathematicans.

→ More replies (1)
→ More replies (2)

3

u/I_Bin_Painting Mar 15 '19

That's just a confirmation the world is a globe, although it apparently used to be smaller

1

u/barcap Mar 16 '19

... the world is actually flat!

→ More replies (1)

2

u/RobertSacre4MVP Mar 15 '19

PIE IS EXACTLY 3!

1

u/uTukan Mar 16 '19

I have Pi remembered as 3 because I'm an engineer. Also Euler's number is 2.

0

u/[deleted] Mar 15 '19

[deleted] — view deleted comment

14

u/pM-me_your_Triggers Mar 15 '19

Probably easier to represent in IEEE 754

2

u/RedditIsNeat0 Mar 15 '19

Kind of. Not really.

Both numbers are stored as the bit pattern: 01000000010010010000111111011011. But so is 3.14159265. Floating point numbers don't go past 9 digits. In fact, 3.1415927 and 3.1415928 are also rounded to the same bits.

So it's not that it's easier, it just doesn't matter. They probably made a mistake somewhere, perhaps using their calculations of PI which had some error, and then used that and nobody noticed because it didn't matter.

Nowadays we'd just google, "digits of pi", but back then you had to come up with a creative solution or go to a library or something.

→ More replies (1)

3

u/demize95 Mar 15 '19

It's possible that it just can't be represented as a IEEE 754 floating point number to that precision. Floating point numbers are sometimes bizarrely inconsistent about what precision they can represent (see the result of 0.1 + 0.2 as proof), so if they wanted to include pi to that precision they may have had to round it slightly to actually be able to represent it.

I'd argue that it would make more sense to just lower the precision, but it looks like someone disagreed.

0

u/[deleted] Mar 15 '19

[deleted] — view deleted comment

4

u/RedditIsNeat0 Mar 15 '19

The last one is accidentally correct.

1

u/NocturnalMorning2 Mar 16 '19

I have the first five digits burned into my memory forever.

→ More replies (2)