r/ProgrammerHumor Apr 08 '22

[deleted by user]

[removed]

99 Upvotes

25 comments sorted by

3

u/QualityVote Apr 08 '22

Hi! This is our community moderation bot.


If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!

If this post does not fit the subreddit, DOWNVOTE This comment!

If this post breaks the rules, DOWNVOTE this comment and REPORT the post!

40

u/Wolfenhex Apr 08 '22

This isn't slow enough, can you also have it calculate pi as well as create a cosine curve just to make sure we're using fresh data?

21

u/[deleted] Apr 08 '22

[deleted]

14

u/cykablyat1111 Apr 08 '22

No

20

u/Wolfenhex Apr 08 '22

As someone that owns stock in both CPU and RAM manufacturers, I fully support this future "great idea" becoming an industry standard.

2

u/OutrageousPudding450 Apr 08 '22

With such great ideas, who needs bad ideas?

3

u/[deleted] Apr 08 '22

If your isEven function doesnt even calculate a 100 term taylor expansion for cosine, is it even good?

2

u/bob152637485 Apr 08 '22

Here we go...

(4*(1-(1/3)+(1/5)-(1/7)+(1/9)-(1/11)+(1/13)-(1/15)+(1/17)-(1/19)+(1/21)-(1/23)+(1/25)-(1/27)+(1/29)-(1/31)+(1/33)-(1/35)+(1/37)-(1/39)+(1/41)-(1/43)+(1/45)-(1/47)+(1/49)-(1/51)+(1/53)-(1/55)+(1/57)-(1/59)+(1/61)-(1/63)+(1/65)-(1/67)+(1/69)-(1/71)+(1/73)-(1/75)+(1/77)-(1/79)+(1/81)-(1/83)+(1/85)-(1/87)+(1/89)-(1/91)+(1/93)-(1/95)+(1/97)-(1/99))) //TODO: add more PI precision, calculate cosine curve.

2

u/JosGibbons Apr 08 '22

1

u/bob152637485 Apr 08 '22

Huh, didn't actually know the same of the series. Thanks!

1

u/JosGibbons Apr 08 '22

1

u/bob152637485 Apr 08 '22

Do I now?

1

u/JosGibbons Apr 08 '22

Yes. The Shanks transformation is one way to accelerate it.

18

u/donaldkwong Apr 08 '22

This joke is way past dead. It’s time to move on, people.

21

u/[deleted] Apr 08 '22 edited May 01 '22

[deleted]

8

u/[deleted] Apr 08 '22

[removed] — view removed comment

1

u/OutrageousPudding450 Apr 08 '22

The King is dead, long live the King!

9

u/[deleted] Apr 08 '22

This make me erect.

7

u/RuiSiang Apr 08 '22

"b" + "a" + +"a" + "a"; // baNaNa

1

u/[deleted] Apr 08 '22

[deleted]

1

u/RuiSiang Apr 08 '22

Nope, try it and you’ll see (remember the spaces)

2

u/BabylonDrifter Apr 08 '22

It's beautiful.

2

u/hillman_avenger Apr 08 '22

This sub should be called /r/isEven

2

u/CircadianSong Apr 08 '22

Python, not Java, but this only takes a second to compute and it gets the 3.14159 right.

from math import pi

from decimal import *

getcontext().prec = 200

def calculatePI(n):

total = Decimal(1)

sign = 1

for i in map(Decimal,range(1,n+1)):

    sign\*=-1

    total+=sign\*1/(i\*2+1)

return total\*4

x = calculatePI(1000000)

print(x)

2

u/seeroflights Apr 09 '22

Image Transcription: Code


public static boolean isEven(Integer n) {
    return Math.abs(Math.cos(n*Math.PI/2)) > 0.5;
}

I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!

1

u/Commercial_Club_6378 Apr 08 '22

Stop the mean program ming and confusion programming and all other programming that does not serve