mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
division by zero #233148 16/07/11 03:33 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
x/x=1 take x=0 than 0/0=1

Re: division by zero [Re: Marek_Andrzej] #233149 16/07/11 03:34 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
Originally Posted By: Marek_Andrzej
x/x=1 take x=0 than 0/0=1

Re: division by zero [Re: Marek_Andrzej] #233150 16/07/11 03:58 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
0/0 is not equal to 1. It *should* be an invalid mathematical operation giving a divide by 0 error. mIRC instead just says it equals 0. There was discussion on that in the past, but I don't remember the reasoning behind it. Maybe just to make a script not halt if the denominator is 0.

In any case, you should always check if the denominator = 0, and if so, don't do the math because it's not valid. But whatever way you look at it, 0/0 is never going to be 1.


Invision Support
#Invision on irc.irchighway.net
Re: division by zero [Re: Marek_Andrzej] #233154 16/07/11 10:09 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Anything divided by 0 is infinity, theoretically, but practically speaking it is undefined. Either way, it is not 1. mIRC returns 0 because a computer can't represent infinity except via symbol, and it's not appropriate for mIRC to return a symbolic value. As stated, you should do your own sanity checking on valid calculations.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: division by zero [Re: argv0] #233155 16/07/11 11:23 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Originally Posted By: argv0
Anything divided by 0 is infinity, theoretically, but practically speaking it is undefined. Either way, it is not 1. mIRC returns 0 because a computer can't represent infinity except via symbol, and it's not appropriate for mIRC to return a symbolic value. As stated, you should do your own sanity checking on valid calculations.


I know it's a minor point, but the part in red is not actually correct. Division by zero is undefined (both theoretically and practically speaking). Infinity is a concept, not a number, and therefore cannot be the result of a mathematical operation on the real numbers.

Anyway, that doesn't take away from the point of your post, which is that Khaled decided to give nonsensical results for division-by-zero calculations instead of having to deal with throwing/handling an error.

Re: division by zero [Re: drum] #233156 16/07/11 11:37 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It would be useful to be able to tell if a divide-by-zero has occurred within a call to $calc() though since it isn't always feasible to check the values to be calculated beforehand.

If returning $null or some other value indicating an error from $calc() itself isn't possible for practicality or backwards compatability purposes perhaps a $divzero identifier that could be checked after a call to $calc() could be made available instead.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: division by zero [Re: starbucks_mafia] #233157 17/07/11 01:18 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If anything, it should give an error. $null isn't really any more accurate than 0. It's just easier to deal with. Of course, in the majority of calculations, you know if it's divided by 0. Yes, if you're making a !calc script or something similar, you might not know. But most of the time, you do know what the numbers are and can easily check if it's divided by 0.

If we're going to change it, then we should do it the right way... throw a #DIV/0 error.

Anyhow, no matter how it's handled, the script will be required to deal with invalid math. And 0/0 is never equal to 1.


Invision Support
#Invision on irc.irchighway.net
Re: division by zero [Re: drum] #233159 17/07/11 04:04 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Wikipedia agrees with me. Division by zero is undefined in the real number space, not all of mathematics. The fact that Mathematica, a (the most?) well respected math program, returns ComplexInfinity for division by zero operations, is further evidence that the math community is behind this concept.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: division by zero [Re: starbucks_mafia] #233160 17/07/11 04:13 AM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: starbucks_mafia
It would be useful to be able to tell if a divide-by-zero has occurred within a call to $calc() though since it isn't always feasible to check the values to be calculated beforehand.


yikes, i remember that thread ;P

what i've since discovered is that, while it isn't easy to detect a division by 0 in the midst of any arbitrary expression, we can still perform exception handling to some extent:

Code:
  var %expression = 1/(1-1)
  if (!$calc(0 * (%expression) + 1)) { echo -a error in %expression }


this works since $calc() immediately returns 0 as soon as it encounters a problem. this problem is not limited to division by 0 though, it also occurs when the expression is syntactically invalid (eg. %expression = 1+a, but not %expression = 1+$a) or, rather unfortunately, when the result of a power operation is too large (eg. %expression = 9^999).

i say 'to some extent' since the above method both fails to detect certain invalid expressions (when '$' is used, such as in '1+$a', but we can still easily check that ($ !isin %expression) on top of it) and, more worryingly, falsely detects valid expressions (9^999 is a valid expression but fails due to its size).


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: division by zero [Re: argv0] #233161 17/07/11 06:09 AM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Originally Posted By: argv0
Wikipedia agrees with me. Division by zero is undefined in the real number space, not all of mathematics. The fact that Mathematica, a (the most?) well respected math program, returns ComplexInfinity for division by zero operations, is further evidence that the math community is behind this concept.


I can understand why it would be misleading, but "complex infinity" is the name given to a value which specifically exists only in the extended complex numbers. This is not synonymous with "infinity". Mathematica performed your calculation on the extended complex numbers because it's the only way your input would make sense, as it is one of the rare situations where it is possible to define division by zero.

But the point is, mIRC only performs real number arithmetic, so none of this is really relevant.

Re: division by zero [Re: Marek_Andrzej] #233163 17/07/11 10:19 AM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
every number division by the same number is 1 for example
3/3=1, 2/2=1 1/1=1 because (the same number)/(the same number)always equil 1

Re: division by zero [Re: Marek_Andrzej] #233164 17/07/11 11:03 AM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: Marek_Andrzej
every number division by the same number is 1 for example
3/3=1, 2/2=1 1/1=1 because (the same number)/(the same number)always equil 1


no no no NO NO NO NO NO


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: division by zero [Re: Marek_Andrzej] #233166 17/07/11 01:19 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Marek_Andrzej
every number division by the same number is 1 for example
3/3=1, 2/2=1 1/1=1 because (the same number)/(the same number)always equil 1


Not true. Look at it this way. If you have 0 pieces of pie and you divide those pieces equally among 0 people (0/0), how many pieces of pie does each person get? It isn't 1. It also isn't really equal to 0 because there aren't any people to give the pie out to. That's why division by 0 is invalid. Still, 0 is a much better answer than 1. An error would be the better answer overall.

The statement that you sometimes hear in lower level math courses (elementary/middle school level) that any number divided by itself equals 1 is a generalization meant to help students remember what 3/3 or 6/6 or 123456/123456 is equal to. Later, students are told of the exception to the rule, where 0/0 is not equal to 1. There are other types of generalizations that are used when teaching math and then once you get those down, you are taught the exceptions. It's easier than starting out by telling a student that "this is true except when this is true or when that is true or when this happens."

It's similar to teaching a language, such as English. You don't jump in and tell students every possible sound a vowel like "a" or "e" makes. Instead, you give them generalizations. "If a word as 'ea' together, then the 'e' is long and the 'a' is silent." In most cases, that's true and a good start for teaching the two-vowel sounds. However, it's not always true. For example, "instead". Or you generalize that a vowel between two consonants is short. That's true much of the time, but there are exceptions (toll, make, there). However, you don't start teaching the exceptions right away or you confuse the students. Especially since the English language seems to have more exceptions than rules. It's the same with math. Many of the "rules" have exceptions that you need to be aware of.

Last edited by Riamus2; 17/07/11 01:45 PM.

Invision Support
#Invision on irc.irchighway.net
Re: division by zero [Re: Marek_Andrzej] #233167 17/07/11 01:33 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
I agree with all but its not explaning why not 0/0=1

Re: division by zero [Re: Marek_Andrzej] #233168 17/07/11 01:48 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Did you not read my example with pie? Tell me how you are giving out 1 piece of pie in that example. It should be a pretty easy example to see.

You can't create something out of nothing. 0 and 0 are nothing, so you can't create 1 out of it. Note that that's not necessarily a great example because math probably can manage to create a number out of 0 using complex math, but using basic math, it does fit.

If you don't believe us, ask any math teacher.


Invision Support
#Invision on irc.irchighway.net
Re: division by zero [Re: Marek_Andrzej] #233169 17/07/11 01:49 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: Marek_Andrzej
I agree with all but its not explaning why not 0/0=1


what? that is the only thing being explained, so clearly you either do not agree with it, or you don't understand it.

if we're working in the ring of real numbers and 0/0 is 1, what is 4*(0/0)? what about (4*0)/0? are they different? why?

can you not see why defining 0/0 = 1 is a problem?


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: division by zero [Re: Riamus2] #233170 17/07/11 01:52 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: Riamus2
You can't create something out of nothing. 0 and 0 are nothing, so you can't create 1 out of it. Note that that's not necessarily a great example because math probably can manage to create a number out of 0 using complex math, but using basic math, it does fit.


0 ^ 0 is defined in many branches of mathematics, as well as in $calc(), to be 1 ;P


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: division by zero [Re: jaytea] #233171 17/07/11 01:54 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, I was thinking about that after I wrote it. blush

That's actually something I never really figured out. The WHY of that one baffles me. laugh Of course, I should probably read up on what ^0 actually means anyhow. Normally, you look at it as multiplying the base number by itself that many times (counting the original number). 2^3 is 2*2*2. But 2^0 isn't multiplying 2 by itself 0 times. I guess I should look that one up and see what the reasoning behind it is.

EDIT: Ok, I looked up the ^0 issue and it makes sense by changing the order of the math... a^(n-1) = a^n/a, so a^(1-1) = a^1/a = 1. Though... that seems to contradict 0^0 = 1. Because 0^1 / 0 != 1 as we're discussing here.

EDIT2: Found this which is interesting. It gives a good view on 0^0 and fits in well with the divide by 0 issue. So, 0^0 isn't really 1... 1 is just used to make it more useful and consistent.

Last edited by Riamus2; 17/07/11 02:10 PM.

Invision Support
#Invision on irc.irchighway.net
Re: division by zero [Re: Marek_Andrzej] #233172 17/07/11 02:18 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
o ya 0^0=1 then 0/0=(0/0)^0=(0^0)/(0^0)=1/1=1

what about 4*(0/0) and (4*0)/0 I don't know now but this is argumenth

Re: division by zero [Re: Marek_Andrzej] #233173 17/07/11 03:08 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
on the other way

if x->0 then limes(x/x)=limes(x'/x')=limes(1/1)=1

Re: division by zero [Re: Marek_Andrzej] #233174 17/07/11 03:51 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Basically 0^0 and 0/0 are undefined in a strict interpretation, but in specific applications it is convenient to allow them to take on particular values. In the case of 0^0, it turns out that it is convenient in a LOT of situations to let it equal 1 because it has certain implications, but even so it's not rigorously correct. On the other hand, defining 0/0 a particular way doesn't really seem to have the same kind of ramifications so it's mostly left undefined.

Re: division by zero [Re: Marek_Andrzej] #233175 17/07/11 03:55 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Originally Posted By: Marek_Andrzej
on the other way

if x->0 then limes(x/x)=limes(x'/x')=limes(1/1)=1


That just tells you that the expression x/x tends toward 1 when x tends toward 0. It doesn't say that 0/0 equals anything.

Limits describe behavior AROUND a point, but completely ignores the behavior AT that point.

Re: division by zero [Re: Marek_Andrzej] #233176 17/07/11 07:57 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: Marek_Andrzej
I agree with all but its not explaning why not 0/0=1


0 divided by any number cannot be 1 because 0 is less than one to begin with!

Re: division by zero [Re: Marek_Andrzej] #233178 17/07/11 08:59 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
this the question is zero is real number or not

Re: division by zero [Re: Marek_Andrzej] #233180 17/07/11 09:33 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Zero is a real number, yes.

But that wasn't the original question. The original question raised by your post was this:
Does dividing zero (or any other value) by zero equal zero, one, or any other meaningful value?

The answer is simple and very well established: No. It does not.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: division by zero [Re: Marek_Andrzej] #233181 17/07/11 10:12 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
if zero is real number than why is not the same of the real numbers because not division by zero?

Re: division by zero [Re: Marek_Andrzej] #233182 17/07/11 10:46 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Lets turn the question around: Why do you think 0 / 0 = 1? You can't just say "A number divided by itself equals one, therefore the result for this calculation must be one", that's backwards. Mathematics is based on logic. A rule is made based on the facts, not the other way round. Give a mathematical proof that 0 / 0 = 1 and then you can state that any number divided by itself equals one. Until then there is no such rule or at the very least zero is an exception to that rule.

Frankly though this is all beyond the scope of this forum. This isn't the place to try and redefine fundamental tenets of mathematics, it's just a forum for an IRC client and its scripting language. Division by zero being undefined is a well established fact in maths, I'm certain there are many many places on the internet where it is explained much more clearly and in far greater detail than any answer you will get on this forum.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: division by zero [Re: Marek_Andrzej] #233183 17/07/11 10:51 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
I don't know either world forums. I think that 0/0=1 because that logical string of R/R all number gives 1 only 0 not why?

Re: division by zero [Re: Marek_Andrzej] #233184 17/07/11 10:58 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
For the sake of this thread lets just say that it's because 0 is magical.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: division by zero [Re: Marek_Andrzej] #233185 17/07/11 11:08 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
if zero is magical why is in set of real numbers

Re: division by zero [Re: Marek_Andrzej] #233186 17/07/11 11:22 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Aforementioned link http://en.wikipedia.org/wiki/Division_by_zero gives several algebra/calculus (i.e. "high school level math") examples why not. While I cannot comprehend any "higher" math, they are quite plausible to me. Did you give serious thought to them, or do you just adhere to a simple mnemonic?

Re: division by zero [Re: Marek_Andrzej] #233187 17/07/11 11:29 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
wikipedia is not good place for this .

Re: division by zero [Re: Marek_Andrzej] #233188 17/07/11 11:33 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
I read the wikipedia and say that I say ,because:
if 0/0=1 then 1*0=0 then all right

Re: division by zero [Re: Marek_Andrzej] #233189 17/07/11 11:38 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The "all right" part is your conclusion, not Wikipedia's. If you had read that article more carefully, you would have seen the following:
Originally Posted By: http://en.wikipedia.org/wiki/Division_by_zero#Division_as_the_inverse_of_multiplication
Again, any number multiplied by 0 is 0 and so this time every number solves the equation instead of there being a single number that can be taken as the value of 0/0.

In general, a single value can't be assigned to a fraction where the denominator is 0 so the value remains undefined (see below for other applications).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: division by zero [Re: Marek_Andrzej] #233191 17/07/11 11:51 PM
Joined: Jul 2011
Posts: 13
M
Marek_Andrzej Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jul 2011
Posts: 13
I don't write about any number but only 0

Page 1 of 2 1 2