Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/PROG/ Challenge Number 3 - Pi

Name: Anonymous 2007-09-13 22:45 ID:IZip/Yni

Make a program to calculate pi to the n'th decimal. Input the variable at runtime.  Program In the language of you choice. (and none of the print"3.1415" crap.)

Name: Anonymous 2007-09-14 10:48 ID:WWWs1FtP

It works on that link (Firefox and IE tested), put a number (and nothing else) in the input field. I don't exactly put error handling in brainfuck.

That implementation is very strict and if it works there, it should work everywhere. No moving to before memory cell 0, no overflowing or underflowing. EOF = 0. Moving past 30000 is allowed to be Turing complete, but this program doesn't go there by far.

Only issue with my code is that the highest number you can input is 254 before the counter overflows. I guess it gets weird input on your implementation.

And yes, it's supposed to output 3.142857 repeating. That's 22 / 7, it's pretty hard to really calculate pi in brainfuck.

Name: Anonymous 2007-09-14 11:03 ID:Heaven

>>41
It works on that link (Firefox and IE tested), put a number (and nothing else) in the input field.
Ah, now it works

Very nice work.

Name: Anonymous 2007-09-14 13:09 ID:p0bpMm5E

It's really too bad that in the real world, you never have to do stuff like calculate Pi or factorials, because that's pretty much the only thing useless toy languages really shine at.

Name: Anonymous 2007-09-14 15:37 ID:+p85jMAE

so far nothing has been successful... lol

Name: Anonymous 2007-09-14 16:09 ID:Heaven

>>27
>>44
This ``challenge'' is officially crap. Methods of pi digit extraction are no secret, and most are trivial to implement. This tests your ability to use Google and nothing else.

Name: Anonymous 2007-09-14 17:16 ID:Heaven

>>1
Read SICP (Section 3.5.3)

Name: Anonymous 2007-09-14 21:52 ID:+p85jMAE

I see this challenge has failed. I shall come up with another.

Name: Anonymous 2007-09-14 21:59 ID:xBurq3xB

>>32
pi in base pi would be 10.

Name: Anonymous 2007-09-14 22:00 ID:xBurq3xB

>>45
found it myself. Go fuck yourself faggots. 90% of you can't program but just talk about how satoori you are when you shove SICP up your asshole

Name: Anonymous 2007-09-14 22:01 ID:W3mYKou3

1 in base 1 would be 10

Name: Anonymous 2007-09-14 22:13 ID:Heaven

>>50
It would also be any one of these
1
10
100
10000
1000000000000000000000

Name: Anonymous 2007-09-14 22:13 ID:MPVsRCXO

<?php

get_pi();

?>

winrar

Name: Anonymous 2007-09-14 22:14 ID:pmk4hbO8

Protip: Use Manchin's formula:
pi = 4*(4*arctan(1/5) - arctan(1/239))

If you want it more precise:
pi = 4*(183*atan(1/239)+32*atan(1/1023)-68*atan(1/5382)+12*atan(1/113021)-100*atan(1/6826318)-12*atan(1/33366019650)+12*atan(1/43599522992503626068))

Use modulus division to get the digit you want. Trivial.

But, let's get serious... pi to 30 digits is enough to compute the visible universe with almost no error. For most cases, you don't need lots of digits. It's a parlor trick.

Next?

Name: Anonymous 2007-09-14 22:16 ID:pmk4hbO8

>>53
It'd be better if I didn't flip digits around, and I spelled Jon Machin's name right.

4*(183*atan(1/239)+32*atan(1/1023)-68*atan(1/5832)+12*atan(1/113021)-100*atan(1/6826318)-12*atan(1/33366019650)+12*atan(1/43599522992503626068))

Fix'd.

Name: Anonymous 2007-09-14 22:18 ID:ZdnvaXeQ

2 in base φ would be 10.01

Name: Anonymous 2007-09-14 22:20 ID:qEUxmkj+

A student was complaining about digital numbers. 'When I take the root of two and then square it again, the result is already inaccurate!'. Overhearing him, Fu-Tzu laughed. 'Here is a sheet of paper. Write down the precise value of the square root of two for me.'

Name: Anonymous 2007-09-14 22:23 ID:pmk4hbO8

>>56
e^(.5*ln(x)).

Works for me.

Name: Anonymous 2007-09-14 23:51 ID:Heaven

>>44
see
>>15

Name: Anonymous 2007-09-16 1:23 ID:VnCbxHj3

>>53
only person who know how to do it ITT
everyone is a butthurt faggot that can't admit there's some things they don't know.

Name: Anonymous 2007-09-16 1:32 ID:Heaven

>>59
trying too hard

Name: Anonymous 2007-09-16 4:44 ID:Heaven

>>60
faggot

Name: Anonymous 2007-09-16 5:16 ID:D97PAMV/

>>53
>>59

same person?

Name: Anonymous 2010-12-06 10:15

Are you GAY?
Are you a Haskell Programmer?
Are you a Raging Animu Fanboi?

If you answered "Yes" to all of the above questions, then /praque/ might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 4:57

Name: Anonymous 2011-02-18 13:41

dubz

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List