4 billion if statements (2023)
131–140 of 183 posts
Re: 4 billion if statements (2023)
#132https://github.com/toji/gl-matrix/blob/master/dist/gl-matrix...
Re: 4 billion if statements (2023)
#133Earlier quoted context omitted.
How is this time efficient at all? It takes upwards of 40 seconds to compute on large 32bit values. It's a joke post with some interesting bits and details.
How are you able to recognize a joke post but not a joke comment?
Re: 4 billion if statements (2023)
#134Re: 4 billion if statements (2023)
#135Earlier quoted context omitted.
How is this time efficient at all? It takes upwards of 40 seconds to compute on large 32bit values. It's a joke post with some interesting bits and details.
The comment you're replying to is also a joke, with some interesting bits and details.
Re: 4 billion if statements (2023)
#136Re: 4 billion if statements (2023)
#137This could be obviously done with much less code: Just add "if"s for all even number, and at the end just return "odd" if none of the evens matched. 50% less code! Or even simpler: If it's 0, return "even". If not, do a recursive call to n-1, if that equals "even", return "odd", otherwise return "even". But the best way is probably to just use a library. Yes, 500MB of additional dependencies, but then it's a one-line…
But then, even numbers will have the worst possible performance.
Re: 4 billion if statements (2023)
#138Any good engineer knows there is no "best" solution, only tradeoffs. Save space. def even_flip_flop(number): even = True for _ in range(number): even = not even return even Ditto. Sure, this overflows the stack, but you look cool doing it. def even_recursive(number): return True if number == 0 else not even_recursive(number - 1) Save time. Just buy more RAM. table = [True, False] * 1000 # adjust to your needs def eve…
Re: 4 billion if statements (2023)
#139Re: 4 billion if statements (2023)
#140Gemini took 4 seconds to answer this prompt: "Here is a number 4200020010101. Think deeply about it and tell me if it is not or or not even." So if you're concerned with privacy issues, you can run the assembly version proposed in the article locally and be well within the same order of performance. Let's thank the author of the article for providing a decent alternative to Google. ah, but the license is not that goo…
Finally a problem that Microsoft Phi can ace. Probably. Maybe. Some of the time at least.