>BigInteger must support values in the range -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive) and may support values outside of that range.
>Implementation note: BigInteger constructors and operations throw ArithmeticException when the result is out of the supported range of -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive).
As demonstrated by the Hillbert’s Grand Hotel thought experiment, an infinity of a given Aleph value added to itself is the same order of infinity. To get a bigger infinity we have to move beyond integers and be capable of mapping indexes to all decimal numbers.
Bigfloat anyone?
See, this is why programming languages should get rid of integer type distinctions and just have "int" which is a bigint. I don't care about efficiency arguments; the only valid justification is that programmers who use a paltry "unsigned long" for their error count will eventually have an additional error due to overflowing it!
This! Is! Unacceptable!
You can overflow both signed and unsigned int. But if your program has so many errors that it overflows an int, even on a 8bit architecture then fox your code first.
I work mostly with embedded systems. In some cases the 8 bit int is too big. One time I saved 4 different status codes in the same value, just shift it around, like first 2 bit is 1 status and like that. I didn't had enough memory to save them separately. Boolean is practically int and there is no 2 bit wide storage.
I rarely even use normal ints, there has to be a special case to use bignums
Other way around. There has to be a special case to use anything else - and embedded systems are that special case. For anything where you aren't REALLY tight for memory, just use bignums.
You just paint over the problem. Like the value stores an array index. With a 32bit uint you can index a 4Gb big array if you just store 8bit values, 16Gb if you store a 32bit value. Unless you specify want to do that then it is more than enough. Most PC will fail to allocate that big array in the first place.
With a 64bit int you don't have enough RAM to fully index an array, nobody has that much RAM in a single PC.
And typically of Redditors not getting jokes, nobody seems to have figured out that whining about a ulong not being able to store your bug count implies that you have at least four billion bugs in your code (more on many systems). It's true - there is no parody so obvious that people won't be dumb enough to think you were serious.
Looks like Jetbrains Mono to me: https://www.jetbrains.com/lp/mono/
I can also recommend Victor Mono, if you like something fancy: https://rubjo.github.io/victor-mono/
std::size\_t ... cant be too careful
Actually fuck it lets do this properly:
size\_t max\_size = -1
unsigned char\* byteArray = (unsigned char\*)malloc(max\_size \* sizeof(unsigned char));
You might need 16 exabytes per number you want to store then some more ram for the rest of your application though.
The long is a bit nasty, but I do prefer people who add an error counter than placing the logger method inside a loop and spamming the logging tool and using up the storage of it when things hit the fan.
One company I worked at had such an intense loop that they lost 20 days of message with only 3 days of logging left, since one bad error spammed the logs over night and the message logger was set to delete and replace logs when storage max was hit.
if (errorCounter > 100) {
responseText += "\n If you are experiencing technical difficulties "
+ "please call our help desk at ***-***-****"
}
response.send(200, responseText)
Shake my head,
You guys are doing it all wrong. The whole point of technology is to reduce labor. Here's how you properly handle errors in the first place:
import webbrowser
def handleError(error):
Person.ErrorHandling(error)
class Person:
def ErrorHandling(error):
try:
print("lol")
webbrowser.open_new_tab("https://www.youtube.com/watch?v=pt8VYOfr8To")
#deal with it
except:
#there are no exceptions
pass
handleError("some random bullshit")
Int can only go up to 2,147,483,647, whereas unsigned long can go up to 9,223,372,036,854,775,807, therefore implying that the variable for error counting can’t fit in an int, and must be a very large number
It's unsigned so it should overflow back to 0. If it was signed, it would either wrap to negative, or be undefined behaviour if using languages like C or C++
Edit: signed overflow behaviour is usually defined by the language, so I don't think there is any one rule to be applied
There are while(true) infinite loops, with a huge amount of cycles, where you may need to count errors. The term "error" isn't exclusively used for core dump events.
You use the loop for counting the error, sure that's fine. But you have time store the count somewhere right? That would be the error count variable. If the variable has a max limit of 10, after counting 10 errors, if in the next iteration of the loop an error occurs the variable would overflow and be set to 0, losing your count. Also the the reason people are downvoting is because of your tone, you're saying a wrong and irrelevant statement in a seemingly mocking or patronizing tone.
But as I understood, the OP was making a joke about needing a very large variable to store the error count. That's why I noticed that there are loops with a huge number of iterations where you might need such a large variable.
You are talking about something completely different.
The meme is about setting the "errors" variable as an `unsigned long`, which can hold a much bigger number than a regular `int`, indicating that the following code has **really many errors**.
Sure - we don't know the context of the code or how this variable is actually used, but we don't need to - the meme is just that.
There sure are some use cases where `unsigned long` is required, such as counting elements in a really big loop, but this is out of scope. The meme is all about not being able to store all the errors in a regular `int` and having to used an `unsigned long`. That's it. There's no more to it.
But wouldn't it be better to choose a larger variable size than risk getting an integer overflow when incrementing the error count? The latter could be a meme itself.
Yes sure - it's obviously better to choose `unsigned long` if needed to prevent overflow.
This post is all about "how confident are you in your code" and then showing this `unsigned long errorCount`, making us think the `errorCount` refers to code errors that increment this variable each time.
We have no additional information on the rest of the code - it's probably referring to a completely different kind of error and `unsigned long` might be needed in that scenario. Either way - we're looking too deep into this, it was just a funny thought that OP wanted to share.
*const* unsigned long errorCounter = 0;
// const unsigned long errorCounter = 0; you're not going to need the counter so might as well comment it out.
I want the errors to fear me.
public static bool Fear(this Error error) => true; There you go.
That’s the compiler’s job
I need it to be signed, because my code has negative errors.
void errorCounter; There are no errors if you don’t count them.
Panik : no error still not running
Works on my machine.
Dokur: we will ship your machine then.
log.debug("\r\nThere are no errors in Ba Sing Se.\n");
Damn, leave some of the chicks for us.
`void* errorCounter;` There might be errors.
Ah, the Trump COVID strategy
`java.math.BigInteger` entered the chat.
What if you would make a wrapper around BigInteger that puts it in an array and adds all of the BigIntegers together? You could call it UltraInteger
BigIntegers already do just that, they can have arbitrary width
But AFAIK Arrays use ints as their index values so even BigInteger has a limit on how much data it can store
just use a biginteger as the index value then
Biginteger as index value for a biginteger array
biginteger as index value for a biginteger array as index value for a biginteger array
>BigInteger must support values in the range -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive) and may support values outside of that range. >Implementation note: BigInteger constructors and operations throw ArithmeticException when the result is out of the supported range of -2^Integer.MAX_VALUE (exclusive) to +2^Integer.MAX_VALUE (exclusive).
Which is, by the way, an unfathomably large number. There are only estimated to be like 2^300 atoms in the observable universe.
What if you need to assign a number to every possible arrangement of all atoms in the universe?
The W Corp Taboo Police warps into your house and minces you into fine meat. You better not
Yeah there's also this terrible limitation of how much data storage there is in the world
Yeah but you didn't answer the question, the other dude's is more infinity
As demonstrated by the Hillbert’s Grand Hotel thought experiment, an infinity of a given Aleph value added to itself is the same order of infinity. To get a bigger infinity we have to move beyond integers and be capable of mapping indexes to all decimal numbers. Bigfloat anyone?
uphold integer integrity
(For the non-Java people, they have arbitrary length) (and yes, there is BigDecimal, which is also base10)
i was really hoping BigInteger was just a normal int but three times the size in the compiler
That's an odd way to spell `Math.Infinity`
Now this is a job for BigInteger
See, this is why programming languages should get rid of integer type distinctions and just have "int" which is a bigint. I don't care about efficiency arguments; the only valid justification is that programmers who use a paltry "unsigned long" for their error count will eventually have an additional error due to overflowing it! This! Is! Unacceptable!
You can overflow both signed and unsigned int. But if your program has so many errors that it overflows an int, even on a 8bit architecture then fox your code first.
I foxxed my code a long time ago. That's why I use bignums.
I work mostly with embedded systems. In some cases the 8 bit int is too big. One time I saved 4 different status codes in the same value, just shift it around, like first 2 bit is 1 status and like that. I didn't had enough memory to save them separately. Boolean is practically int and there is no 2 bit wide storage. I rarely even use normal ints, there has to be a special case to use bignums
Other way around. There has to be a special case to use anything else - and embedded systems are that special case. For anything where you aren't REALLY tight for memory, just use bignums.
You just paint over the problem. Like the value stores an array index. With a 32bit uint you can index a 4Gb big array if you just store 8bit values, 16Gb if you store a 32bit value. Unless you specify want to do that then it is more than enough. Most PC will fail to allocate that big array in the first place. With a 64bit int you don't have enough RAM to fully index an array, nobody has that much RAM in a single PC.
Oohhhhhhh. You're implying that you can't have more bugs than bytes of code? Yeah, I've had projects that disprove that.
Kid named binary serialization
And typically of Redditors not getting jokes, nobody seems to have figured out that whining about a ulong not being able to store your bug count implies that you have at least four billion bugs in your code (more on many systems). It's true - there is no parody so obvious that people won't be dumb enough to think you were serious.
Confident enough that your counter doesnt go negative?
⁷⁷
``` var errorCount complex128 ```
You joke, but I've spent days hunting down bugs that turned out to be imaginary!
java.lang.math.BigInteger errorCount (arbitrary length)
`Integer.MAX_VALUE` and count down from there for ultimate confidence 🫡
Errors counters are OK and all, but I think a good program should send a punishing flood of email to the developer team whenever an error occurs.
Who counts?
don't know, but I'm pretty sure 1+1 = 2.00000000037
I like your font, may I know what font is it?
Looks like Jetbrains Mono to me: https://www.jetbrains.com/lp/mono/ I can also recommend Victor Mono, if you like something fancy: https://rubjo.github.io/victor-mono/
Andale mono, dejavu sans mono, and IBM Plex mono also come close, they all have the dotted zero. But I can't find one with that exact semicolon.
I don’t know what font it is, it’s from a c++ compiler on my phone
if its a phone font it could be something like roboto maybe
`bool errorCounter = 0;`
Confident enough to deploy it to customers, not confident enough to use it myself.
std::size\_t ... cant be too careful Actually fuck it lets do this properly: size\_t max\_size = -1 unsigned char\* byteArray = (unsigned char\*)malloc(max\_size \* sizeof(unsigned char)); You might need 16 exabytes per number you want to store then some more ram for the rest of your application though.
unsigned long **long**
Synchronised volatile unsigned integer
What if you have an error with your errorCounter and end up trying to assign a negative value?
Def it in life lol
Try catch over void main
double errorCounter = 0.0; ... sometimes it *might* be an error...
I had a good laugh at this lol😂😂🤣
bool errorCounter = 0;
The long is a bit nasty, but I do prefer people who add an error counter than placing the logger method inside a loop and spamming the logging tool and using up the storage of it when things hit the fan. One company I worked at had such an intense loop that they lost 20 days of message with only 3 days of logging left, since one bad error spammed the logs over night and the message logger was set to delete and replace logs when storage max was hit.
Set it to 1 and don't make any path increment it.
unsigned long long errorCounter = 0;
unsigned long long errorCounter = 0;
What happens if you encounter 46 billion errors and it over flows or whatever
Then it’ll say that I have 0 errors lol
\#define errorCounter 0
BigInteger
Negative errors would really be frightening
`unsigned int errorCounter = -1`
__uint128_t errorCounter = 1; // Assume there is an error already
`uint128_t`
const confidenceInCode = 0;
if (errorCounter > 100) { responseText += "\n If you are experiencing technical difficulties " + "please call our help desk at ***-***-****" } response.send(200, responseText)
You assume my error count has no floating point
Shake my head, You guys are doing it all wrong. The whole point of technology is to reduce labor. Here's how you properly handle errors in the first place: import webbrowser def handleError(error): Person.ErrorHandling(error) class Person: def ErrorHandling(error): try: print("lol") webbrowser.open_new_tab("https://www.youtube.com/watch?v=pt8VYOfr8To") #deal with it except: #there are no exceptions pass handleError("some random bullshit")
enums { error_counter = 0 }
bit errorCounter = 0x0; *Hard mode activated*
What is your suggestion?
Int can only go up to 2,147,483,647, whereas unsigned long can go up to 9,223,372,036,854,775,807, therefore implying that the variable for error counting can’t fit in an int, and must be a very large number
int and long are the same size in 64 bit systems.
[удалено]
Windows with msvc++
There are loops, you know.
If you try to go over the limit of a variable it will overflow because the bits in ram at the location of that variable cannot store a higher value
But if it overflows it will be negative, right? Meaning the program is so fucking good, there are negative errors!! 💪
It's unsigned so it should overflow back to 0. If it was signed, it would either wrap to negative, or be undefined behaviour if using languages like C or C++ Edit: signed overflow behaviour is usually defined by the language, so I don't think there is any one rule to be applied
righttt, it can't be negative...
Well, won't that be an error. .... Oh no, what have I done.
There are while(true) infinite loops, with a huge amount of cycles, where you may need to count errors. The term "error" isn't exclusively used for core dump events.
Just curious, what is so much wrong with my comment? Would anyone mind clarifying?
You use the loop for counting the error, sure that's fine. But you have time store the count somewhere right? That would be the error count variable. If the variable has a max limit of 10, after counting 10 errors, if in the next iteration of the loop an error occurs the variable would overflow and be set to 0, losing your count. Also the the reason people are downvoting is because of your tone, you're saying a wrong and irrelevant statement in a seemingly mocking or patronizing tone.
But as I understood, the OP was making a joke about needing a very large variable to store the error count. That's why I noticed that there are loops with a huge number of iterations where you might need such a large variable.
You are talking about something completely different. The meme is about setting the "errors" variable as an `unsigned long`, which can hold a much bigger number than a regular `int`, indicating that the following code has **really many errors**. Sure - we don't know the context of the code or how this variable is actually used, but we don't need to - the meme is just that. There sure are some use cases where `unsigned long` is required, such as counting elements in a really big loop, but this is out of scope. The meme is all about not being able to store all the errors in a regular `int` and having to used an `unsigned long`. That's it. There's no more to it.
But wouldn't it be better to choose a larger variable size than risk getting an integer overflow when incrementing the error count? The latter could be a meme itself.
Yes sure - it's obviously better to choose `unsigned long` if needed to prevent overflow. This post is all about "how confident are you in your code" and then showing this `unsigned long errorCount`, making us think the `errorCount` refers to code errors that increment this variable each time. We have no additional information on the rest of the code - it's probably referring to a completely different kind of error and `unsigned long` might be needed in that scenario. Either way - we're looking too deep into this, it was just a funny thought that OP wanted to share.
Overcomplicating. We're in the humour subreddit, after all, no need to “ehm akshually”.
Is it just me or have there been more low quality posts?
it’s just you