@Highwayman Yes, unfortunately. I can't get it accurate past that due to Python's OverflowErrors. If I could avoid those completely somehow, I could make it as accurate as I'd like. Any suggestions?
@LizFoster ehh sadly I can’t think of any. I’d suggest making a BigInt class you self, but floating point will probably be hard enough as it is with out having to deal with making the BigInt as fast/efficient as you can. I bet you could do it though 😏
@LizFoster Oh wait, could the overflow be because you are using a factorial function? maybe the factorial function is using recursion, which would easily make a stack overflow. Maybe if you tried implementing your own factorial function without the recursion, maybe try it out like that??
@Highwayman Yeah.. I don't think Python can handle numbers that big, no matter what. I wonder if there is a way to scale it down to a level that Python can calculate, then scale it back up for the final calculations....?
@Highwayman Hm. Okay. Quick question though, how exactly would I implement this in the context of this program, and how would this help lighten the load? It appears that this method would make the numbers much longer, unless I misunderstand. So sorry..
@LizFoster ehh, maybe. I’m not sure how the decimal module works, but if it has a limit, then ya this could likely surpass that. All this would do is increase the amount of space you give up for a number, allowing for more digits. That wasn’t a good explanation was it? Sorry, :( rushed
@Highwayman No, its a perfectly fine explanation. I only recently learned about the decimal module, and pretty much all I know about it is that you can produce floats with as many decimal places as you specify.
Yeah, good point I suppose. I'll see what I can do, as I don't understand Classes very well yet...
@LizFoster awesome! Classes shouldn’t be too hard I’m guessing, they’re literally just a bunch of variables and functions bunched together basically, and you definitely won’t need any of the more complicated concepts for this anyways I’d say.
@Highwayman I see you have some experience with servers. Can you give me some instructions as to how I can host a c++ server with replit for a unity game?
@Highwayman I love c++, but I got to templates and operator overloading when I switched and started full time unity. I started watching this guy named Sloan Kelly recently tho
@Highwayman Yeah. It's soo easy compared to UE4 c++, which I used for a few months. The memory management becomes a little tough... Movement script is A LOT to do.
(NOTE: It only does 18 iterations, as if you try to do any more, it raises an OverflowError, how lame.. -__-)
わーい, another π approximation method! (I do love these things. π is gorgeous, is it not?)
This is one of the fastest formulae for π out there, used to approximate out to 50 TRILLION DIGITS of π, in January of this year!
The notation for this in Σ is very long, so I have provided a screenshot of it, from its Wikipedia page:
Feedback is greatly appreciated, please enjoy!
If you are interested in learning more, this is the Wikipedia page:
https://en.wikipedia.org/wiki/Chudnovsky_algorithm
(EDIT: Wow! I am glad this was a bit of a conversation starter for you all, thank you so much for all the upvotes!!)
(EDIT 2: I am still getting tons of traction on this, and am glad it is so interesting to all of you. Thank you so much!)
That’s sick! I will say though, it loses basically all accuracy after around the 17th digit it seems. :/
@Highwayman Yes, unfortunately. I can't get it accurate past that due to Python's OverflowErrors. If I could avoid those completely somehow, I could make it as accurate as I'd like. Any suggestions?
@LizFoster ehh sadly I can’t think of any. I’d suggest making a BigInt class you self, but floating point will probably be hard enough as it is with out having to deal with making the BigInt as fast/efficient as you can. I bet you could do it though 😏
@LizFoster Oh wait, could the overflow be because you are using a factorial function? maybe the factorial function is using recursion, which would easily make a stack overflow. Maybe if you tried implementing your own factorial function without the recursion, maybe try it out like that??
@Highwayman Oh! That's a very convenient idea, as I actually made a Product Operator Factorial calculator! (https://repl.it/@LizFoster/Factorials-using-the-Product-Operator)
@LizFoster yeah that does seem pretty perfect! Why don’t you try it out? :P
@Highwayman Right away!
@LizFoster XP
@Highwayman Oh dear, it still does not work, even when implementing my own factorial calculator...
@LizFoster :( dam. It must really be the fact that the BigInt has to be bigger then? Oh well.
@Highwayman Yeah, makes sense after all. After calculating it by hand, a 19th iteration would have a denominator of approximately:
wwwwwww
@LizFoster ohhh yeesh yeah definitely BigInt then! Wow, um. Yeah you’d have to work on a better Bignum then :(
@Highwayman Yeah.. I don't think Python can handle numbers that big, no matter what. I wonder if there is a way to scale it down to a level that Python can calculate, then scale it back up for the final calculations....?
HM(¯▿¯)
@LizFoster I mean you could make a class for that though, can you do bit manipulation in python?
@Highwayman If this is what you mean, then yes:
https://wiki.python.org/moin/BitManipulation
@LizFoster yes exactly that.
@Highwayman Hm. Okay. Quick question though, how exactly would I implement this in the context of this program, and how would this help lighten the load? It appears that this method would make the numbers much longer, unless I misunderstand. So sorry..
@LizFoster ehh, maybe. I’m not sure how the decimal module works, but if it has a limit, then ya this could likely surpass that. All this would do is increase the amount of space you give up for a number, allowing for more digits. That wasn’t a good explanation was it? Sorry, :( rushed
@Highwayman No, its a perfectly fine explanation. I only recently learned about the decimal module, and pretty much all I know about it is that you can produce floats with as many decimal places as you specify.
Yeah, good point I suppose. I'll see what I can do, as I don't understand Classes very well yet...
@Highwayman https://docs.python.org/3.8/library/decimal.html
@LizFoster awesome! Classes shouldn’t be too hard I’m guessing, they’re literally just a bunch of variables and functions bunched together basically, and you definitely won’t need any of the more complicated concepts for this anyways I’d say.
@Highwayman Yeah, exactly. Thank you so much for your feedback here, it's quite helpful. ^ ^ *
@LizFoster yw, I like doing it. this is fun :P
@Highwayman Yeah!
@LizFoster use c++, heh heh...
@nt998302 actually C++ would be perfect for this, it’s what I’ve been using.
...
Granted I still haven’t finished implementing a BigNum class after a full year of trying.
@Highwayman I see you have some experience with servers. Can you give me some instructions as to how I can host a c++ server with replit for a unity game?
@Highwayman I love c++, but I got to templates and operator overloading when I switched and started full time unity. I started watching this guy named Sloan Kelly recently tho
@nt998302 I’m telling you right now you don’t want to do that. Trust me. You’d have to implement the http protocol and that’s a nightmare.
@nt998302 hm. Wait so isn’t unity c#?
@Highwayman Yeah. It's soo easy compared to UE4 c++, which I used for a few months. The memory management becomes a little tough... Movement script is A LOT to do.
@Highwayman eish
@Highwayman Then how would I host some random server thingy?
@nt998302 actually now that I think about it, maybe if you can figure out how to install curlib on repl.it that would make it easy as pie
@Highwayman aight :)
@nt998302 hosting is easy, you just set up the server and click run, repl.it then just wakes up your server every time it gets a request.
@Highwayman Ohhhhh. I thought there was some secret to it xD
@nt998302 nah, it’s super easy XD. gotta love repl.it :P