Feb 22, 2010 at 8:00pm Feb 22, 2010 at 8:00pm UTC
Oh, I forgot about operator preference.
Tbh, the script above (three line one) is what I used to build that; so I know it evaluates to zero.
Feb 22, 2010 at 8:06pm Feb 22, 2010 at 8:06pm UTC
wait a minute... I didn't actually compile it... but there's no way...
*does math*
Apparently I suck at math.
For some reason I didn't make the connection that 16 + 8 = 24
I lose!
Feb 23, 2010 at 1:28am Feb 23, 2010 at 1:28am UTC
Or maybe it just breaks the universe.
Feb 23, 2010 at 1:33am Feb 23, 2010 at 1:33am UTC
I assume by nothing you mean 0.
Line 7 warning: division by zero;
Feb 23, 2010 at 1:36am Feb 23, 2010 at 1:36am UTC
weird, I just did
return 42/0;
got a warning for dividing by 0;
then did:
and it compiles fine
running it however...
Process terminated with status -1073741676
return 42/0;
gives the same status. -1073741676
However:
return 0/42;
terminates program with status 0
Last edited on Feb 23, 2010 at 1:41am Feb 23, 2010 at 1:41am UTC
Feb 23, 2010 at 1:39am Feb 23, 2010 at 1:39am UTC
There must be an exception for div by 0. Is there?
Last edited on Feb 23, 2010 at 1:39am Feb 23, 2010 at 1:39am UTC
Feb 23, 2010 at 1:41am Feb 23, 2010 at 1:41am UTC
Using VC++ it throws an "exception" (not really an exception but you can catch it for some reason).
Feb 23, 2010 at 2:45am Feb 23, 2010 at 2:45am UTC
Assuming x does not equal zero, of course. 0/0 is undefined, as is any value / 0. That's just how it is.
Based on a limit of any number / x, with x approaching zero, the limit should reach infinity. However, that doesn't define divbyzero.
Feb 23, 2010 at 2:51am Feb 23, 2010 at 2:51am UTC
Technically, it does return something -- just what is returned depends on your operating system. Many have a way of indicating program failure, such as an abort due to a hardware exception.
Feb 23, 2010 at 3:40am Feb 23, 2010 at 3:40am UTC
Based on a limit of any number / x, with x approaching zero, the limit should reach infinity.
The proper way to say is: the limit of |a|/x is +∞ as x approaches 0 from the right, and -∞ as x approaches 0 from the left.
Technically, it does return something
I was talking about the function, not the program.
Last edited on Feb 23, 2010 at 6:03am Feb 23, 2010 at 6:03am UTC
Feb 23, 2010 at 4:26am Feb 23, 2010 at 4:26am UTC
I was talking about the program, not the function. :-)
I was responding to gcampton
Feb 23, 2010 at 10:11am Feb 23, 2010 at 10:11am UTC
i made a program using void main() that features looping on a XP, and tried to run it on a win7, but after 2-3 loopings the program closes, then i changed the void main() into int main() with return 0; and now it works fine and i may loop it as much as i want w/o closing it itself
so yeah, dont use void main()
Feb 23, 2010 at 1:03pm Feb 23, 2010 at 1:03pm UTC
That's impossible, having void as a return value could not cause that problem...