Happy pi approximation day! 22/7

Forum: LinuxTotal Replies: 37
Author Content
tuxchick

Jul 22, 2009
6:17 PM EDT
This is an official geek holiday. The other pi approximation day is March 14, which in the US method of date notation is mm/dd, or 03/14.

Party hearty, geeks!
KernelShepard

Jul 22, 2009
7:48 PM EDT
Is this a valid excuse to eat some pie? I sure hope so!
TxtEdMacs

Jul 22, 2009
8:04 PM EDT
I glad you did not say cake ... because not too long after wards it was off with their heads!

So I delicately ask, how does 22/07 or even 07/22 come anywhere close to approximating pi. It's not even half a pie*. Or do you see it as a whole pie? I am confused.

YBT

* If divided by 2.
tuxchick

Jul 22, 2009
8:18 PM EDT
TxtEdMacs, it all makes sense on a pi chart.
tracyanne

Jul 22, 2009
9:52 PM EDT
But surely not in the US where it would have been 7/22
tuxchick

Jul 22, 2009
9:53 PM EDT
TA, in this brave new global society, we cherry-pick whatever calendar format suits us. ;)
tuxchick

Jul 22, 2009
9:54 PM EDT
OMG that was like an instant response, how creepy. I'm not stalking you, really I'm not! I just came in from outside! Really! I swear on the Sacred Official Pi Approximation Day Convenience Calendar!
gus3

Jul 22, 2009
10:27 PM EDT
Ancient Egyptian math worked only with fractions, so 22/7 was the closest they could get.
jdixon

Jul 22, 2009
10:47 PM EDT
> Ancient Egyptian math worked only with fractions, so 22/7 was the closest they could get.

Say what you will about the ancient Egyptians, they were entirely rational. :)
jezuch

Jul 23, 2009
2:17 AM EDT
Quoting:Ancient Egyptian math worked only with fractions, so 22/7 was the closest they could get.


If they dug a bit deeper, they would find 355/113, just as I did sometime in my teens armed with boredom, some free time and a calculator.
golem

Sep 18, 2009
6:55 PM EDT
jezuch: Nice work :) But 22/7 is accurate to within 4 parts in 10,000, and they may not have needed or been able to measure things more precisely than that.
montezuma

Sep 18, 2009
7:06 PM EDT
355/113 is much better.
hkwint

Sep 18, 2009
8:53 PM EDT
Now we need a calendar with 355 moths and 113 days per month. For myself, I like the approximation with the Taylor-series better, but there's no faculty day in the calendar I'm afraid.
tracyanne

Sep 18, 2009
9:09 PM EDT
Quoting:Now we need a calendar with 355 moths


Yuch, I hope not.
gus3

Sep 19, 2009
11:23 AM EDT
3:55am on January 13th.

A pi minute once every year.
da_winkel

Oct 16, 2009
4:54 AM EDT
hey 22/7 is my b'day does that make me a mathematical genius?
TxtEdMacs

Oct 16, 2009
10:44 AM EDT
da'wink,

Only if the year were '09* and you just taught yourself to read and write ... I guess that standard is a bit over bearing, since that would make you an all around genius.

YBT

* well, being too tough here, '08, '07 and even '06 would qualify for geniushood.
hkwint

Oct 16, 2009
1:07 PM EDT
Quoting:does that make me a mathematical genius?


Did your mother told you not to look into the sun? And did you look in the sun anyway?
jdixon

Oct 16, 2009
9:07 PM EDT
> hey 22/7 is my b'day does that make me a mathematical genius?

Possibly. But if so it also makes you irrational. :)
TxtEdMacs

Oct 16, 2009
10:02 PM EDT
Quoting:> hey 22/7 is my b'day does that make me a mathematical genius?

Possibly. But if so it also makes you irrational. :)
But sadly that would make him merely one of very * many.

YBT

* Take any pair of adjacent rational numbers and determine the number of irrational numbers between the pair**.

** An infinite number, that led Kantor to postulate a symbol representing infinity of infinities*** that leads to logical fallacy if one begins defining infinity as the sequence of integers that can be increased with no limit. That is, adding one more integer to any large number.

*** which I remember as infinity raised to the infinite power.
gus3

Oct 16, 2009
10:31 PM EDT
Quoting:if so it also makes you irrational. :)
If so, that makes 22/7 the first irrational fraction I've ever encountered.
Scott_Ruecker

Oct 17, 2009
12:03 AM EDT
Would 1/0 count? I mean, can you have one of nothing? But then math was never my strong suit..
gus3

Oct 17, 2009
12:52 AM EDT
Quoting:gus3@paul$ cat divzero.c #include <stdio.h>

int main(int argc, char *argv[]) { float a = 0.0;

printf("5/0=%fn", 5.0/a); return 0; } gus3@paul$ ./divzero 5/0=inf gus3@paul$


How very odd. No SIGFPE, with both SSE and x87 options.
jezuch

Oct 17, 2009
8:09 AM EDT
Quoting:How very odd. No SIGFPE, with both SSE and x87 options.


Floating point arithmetic never raises an exception. Instead, you can get values like +inf, -inf and NaN (Not a Number). The latter is especially interesting in that if it appears in only one place it "infects" all subsequent calculations turning them all to NaN. Like a quark bomb.
bigg

Oct 17, 2009
8:54 AM EDT
In Fortran (don't know much about C), you can catch an error like that with the right compiler option:

program divbyzero implicit none real :: a = 0.0 write(*,*) 5.0/a end program divbyzero

Quoting:gus3@paul$ gfortran divbyzero.f95 -o divbyzero gus3@paul$ ./divbyzero +Infinity


Quoting:gus3@paul$ gfortran divbyzero.f95 -o divbyzero -ffpe-trap=zero gus3@paul$ ./divbyzero Floating point exception
Scott_Ruecker

Oct 17, 2009
9:07 AM EDT
So I take it my 1/0 thing was lame because whatever you guys are typing makes my eyes hurt. ;-)
bigg

Oct 17, 2009
9:24 AM EDT
> So I take it my 1/0 thing was lame

Humor is usually lost on nerds.
gus3

Oct 17, 2009
11:38 AM EDT
Quoting:So I take it my 1/0 thing was lame
Not at all. It was a teaching moment.

Now I'm reading fenv(3). I want to see how to make it raise a div-zero exception on that instruction.
jezuch

Oct 17, 2009
5:55 PM EDT
Quoting:Now I'm reading fenv(3). I want to see how to make it raise a div-zero exception on that instruction.


Ah, I should have written "...never raises an exception *by default*" ;) The IEEE floating point spec provides a lot of plumbing, like traps and rounding modes. I forget about that because my main language is Java and it doesn't expose any of this (which led at least one expert to write a paper called "Java's FP hurts everyone everywhere").
gus3

Oct 17, 2009
6:03 PM EDT
"Java: Write once, hurt everywhere."

I like it.
hkwint

Oct 17, 2009
7:52 PM EDT
Quoting:So I take it my 1/0 thing was lame because whatever you guys are typing makes my eyes hurt. ;-)


How 'bout this:

Start xcalc, type 1/0 followed by Enter, result is: inf.

Meaning you can have one of nothing infinitely. Myself, I don't have one of nothing, I have much of nothing.
gus3

Oct 17, 2009
8:37 PM EDT
"I got plenty o' nuthin' And nuthin's plenty for me..."

If 1/0 == infinity Then 0 * infinity == 1

But 0 * N == 0, for any N Therefore, by deduction, 1/0 != infinity

I'd rather have the SIGFPE.
Sander_Marechal

Oct 17, 2009
8:48 PM EDT
Gus, there's a flaw in that logic. Infinity is not part of N, so these two are both true at the same time:

0 * infinity = 1 0 * N = 0
hkwint

Oct 17, 2009
9:38 PM EDT
Infinity is not a number, so performing arithmetic with something that's not a number doesn't make sense. I guess that's why we like it so much.
gus3

Oct 17, 2009
10:09 PM EDT
Curiouser and curiouser.

If I change the floats to ints, I do get a SIGFPE.

A floating-point exception. On the integer division instruction.
mortenalver

Oct 19, 2009
6:40 AM EDT
There's no such number as infinity, so 1/0 is really undefined mathematically. However, if you look at the limit when the denominator approaches 0, you find that the value approaches infinity, so it's not terribly illogical for the function to return Inf (it's still not correct, though).
jezuch

Oct 19, 2009
2:52 PM EDT
Quoting:However, if you look at the limit when the denominator approaches 0, you find that the value approaches infinity, so it's not terribly illogical for the function to return Inf (it's still not correct, though).


Yes, and not only because if you approach 0 from the other side, you get negative infinity as the limit :)
gus3

Oct 19, 2009
2:58 PM EDT
Or, more succinctly, "F(x)=1/x" is discontinuous at x=0.

You cannot post until you login.