High frequency traders are busy looking at the next 1 second's report. If they can buy AFTER they sell by taking advantage of the fact that two different trading platforms do it two different ways, then there is a serious risk that the dollar will be toast
No one cares if it takes one second longer to log in to a
Quite a few people care that there are traders who probably have devoted weeks to figuring out how to sell the entire content of Fort Knox, and buy it back one second later (or earlier, according to which time standard you are using) at half price.
I care about these things. It seems like some other people do too.
The solution is, of course, "international agreement" on how to handle the issue. Does not matter which approach, so long as everyone agrees on it. Good luck with that one.
If you're old enough to remember the micronova [I'm a former DG software engineer and I wrote code for it], you can probably remember the PC "turbo" switch. When IBM realized that PCs were outperforming their mid-range business systems (AS400???), they changed the BIOS to prevent boot if the PC ran too fast. Hence, the turbo switch: Run slow until BIOS is done, push turbo switch to get faster clock speed.
That was IBM's first attempt to control [PC] turf. The second came with the micro channel architecture (MCA). Their proprietary licensing caused clone mfgrs to revolt and form a standards organization that produced the ISA bus. Eventually, IBM lost control of a market it created.
Same thing is happening with MS. Tried too hard to map everything back to Win*, even for mobile. Now, they're late to the party and are open sourcing
To hell with it! The Mafia cannot be made illegal - it would be a crime!
They also need a "Do not put any commercial results in here - I am not planning to buy anything, and have no intention of clicking on anything that looks like an advert - and I AM SERIOUSLY CONSIDERING SWITCHING TO BING" option.
The answer is "that was a dumb question"
You cannot share a cake between zero people. The cake may be still whole, but no person has a part of it of any size. Maybe they "could" have a part of almost any size, but that was not the question. (Maybe it should have been, but in that case, you have to provide for different max and min answers, and should have asked the question differently ).
What is the answer to x/0? The answer is "you have got the question wrong!" - otherwise known as Error: divide by zero.
How you report a divide by zero error, is of course somewhat context dependent. Silently ignoring it could well be the right approach if decoding VoIP. If controling a driverless truck - probably is not .
Conclusion: Yes, after rather more than 70 years of computing, we actually have got this one right!
System wide setting? Most other programs don't want it. What you want is a function you can call at the start of your program: no_div_by_zero_exceptions_in_this_program().
But, that is a bad idea (tm) because the programming language/system doesn't know the context. That is, what you intend if div-by-zero occurs on a line-by-line basis. That's why you have to have explicit checks:
if (y != 0)
z = x / y;
else
z =
But, this is just a single check out of the things a program has to check for:
- null pointers
- array bounds
- insane/wrong values (e.g. a person's age shouldn't be a negative number)
- object in wrong state for operation to be performed (e.g. trying to do a database operation when the DB handle isn't locked)
-
Also, drawing on the recent Linux raid0 problem [where FS corruption was happening], they had something akin to:
sector_offset = absolute_byte_position / sector_size;
If sector_size happened to be zero (a programming mistake), silently returning zero here would corrupt the disk/file.
You've been programming for 20 years? Well, junior [I've been programming for 43--sigh], you've still got a lot to learn. And the fact that you didn't see the harm before you posted proves that.
Being a dick isn't against the law.
Assholes and Dicks always skirt around the edges. Yelling at the top of your lungs, hate filled slogans laced with profanity shouldn't be against the law. On the other hand, punching that asshole in the face also shouldn't be against the law
If you're running a program that is expected to see a x/0 problem, sanitize it before processing it. Period.
Sanity check before averaging. If the number of items in a set to be averaged = 0 then don't run that code as it is useless.
I prefer preemptive sanity checks before processing to avoid errors in the first place. You check for 0 BEFORE you divide, as it usually points to some other problem (besides math), in the case above, a null set.
SQRT(-1)
I actually recall someone bemoaning that it is undefined, and thus causing confusion. The proposal, was to create a definition, a symobol/word, to describe a result that is x/0, and leave it at that. Because it does have meaning, we just haven't quite figured out how to wrap it up nice and neat.
MY example is (1+(x/0))*2 is what? Does the fact that x/0 mean that it is not solvable? We have other terms for other numbers that seem impossible. SQRT(-1)
Here's an idea. If you get caught, you get Attempted Murder, assault and all the other charges that should apply. We already have enough laws on the books. We don't need "using a __________ " tack-on charges.
So totalitarianism is okay, as long as the trains run on time. Got it.
Suggest you just sit there and wait till life gets easier.