mIRC Homepage

# division by zero

Posted By: Marek_Andrzej

## division by zero - 16/07/11 03:33 PM

x/x=1 take x=0 than 0/0=1
Posted By: Marek_Andrzej

## Re: division by zero - 16/07/11 03:34 PM

Originally Posted By: Marek_Andrzej
x/x=1 take x=0 than 0/0=1
Posted By: Riamus2

## Re: division by zero - 16/07/11 03:58 PM

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.
Posted By: argv0

## Re: division by zero - 16/07/11 10:09 PM

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.
Posted By: drum

## Re: division by zero - 16/07/11 11:23 PM

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.
Posted By: starbucks_mafia

## Re: division by zero - 16/07/11 11:37 PM

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.
Posted By: Riamus2

## Re: division by zero - 17/07/11 01:18 AM

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.
Posted By: argv0

## Re: division by zero - 17/07/11 04:04 AM

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.
Posted By: jaytea

## Re: division by zero - 17/07/11 04:13 AM

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).
Posted By: drum

## Re: division by zero - 17/07/11 06:09 AM

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.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 10:19 AM

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
Posted By: jaytea

## Re: division by zero - 17/07/11 11:03 AM

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
Posted By: Riamus2

## Re: division by zero - 17/07/11 01:19 PM

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.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 01:33 PM

I agree with all but its not explaning why not 0/0=1
Posted By: Riamus2

## Re: division by zero - 17/07/11 01:48 PM

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.
Posted By: jaytea

## Re: division by zero - 17/07/11 01:49 PM

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?
Posted By: jaytea

## Re: division by zero - 17/07/11 01:52 PM

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
Posted By: Riamus2

## Re: division by zero - 17/07/11 01:54 PM

Yeah, I was thinking about that after I wrote it.

That's actually something I never really figured out. The WHY of that one baffles me. 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.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 02:18 PM

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
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 03:08 PM

on the other way

if x->0 then limes(x/x)=limes(x'/x')=limes(1/1)=1
Posted By: drum

## Re: division by zero - 17/07/11 03:51 PM

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.
Posted By: drum

## Re: division by zero - 17/07/11 03:55 PM

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.
Posted By: hixxy

## Re: division by zero - 17/07/11 07:57 PM

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!
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 08:59 PM

this the question is zero is real number or not
Posted By: starbucks_mafia

## Re: division by zero - 17/07/11 09:33 PM

Zero is a real number, yes.

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.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 10:12 PM

if zero is real number than why is not the same of the real numbers because not division by zero?
Posted By: starbucks_mafia

## Re: division by zero - 17/07/11 10:46 PM

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.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 10:51 PM

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?
Posted By: starbucks_mafia

## Re: division by zero - 17/07/11 10:58 PM

For the sake of this thread lets just say that it's because 0 is magical.
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 11:08 PM

if zero is magical why is in set of real numbers
Posted By: Horstl

## Re: division by zero - 17/07/11 11:22 PM

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?
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 11:29 PM

wikipedia is not good place for this .
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 11:33 PM

I read the wikipedia and say that I say ,because:
if 0/0=1 then 1*0=0 then all right
Posted By: qwerty

## Re: division by zero - 17/07/11 11:38 PM

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).
Posted By: Marek_Andrzej

## Re: division by zero - 17/07/11 11:51 PM

I don't write about any number but only 0