
Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
Joined: Jul 2011
Posts: 13 
x/x=1 take x=0 than 0/0=1




Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
Joined: Jul 2011
Posts: 13 
x/x=1 take x=0 than 0/0=1




Joined: Oct 2004
Posts: 8,330
Hoopy frood

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




Joined: Oct 2003
Posts: 3,918
Hoopy frood

Hoopy frood
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"




Joined: Dec 2002
Posts: 344
Pandimensional mouse

Pandimensional mouse
Joined: Dec 2002
Posts: 344 
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 divisionbyzero calculations instead of having to deal with throwing/handling an error.




Joined: Dec 2002
Posts: 2,962
Hoopy frood

Hoopy frood
Joined: Dec 2002
Posts: 2,962 
It would be useful to be able to tell if a dividebyzero 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.




Joined: Oct 2004
Posts: 8,330
Hoopy frood

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




Joined: Oct 2003
Posts: 3,918
Hoopy frood

Hoopy frood
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"




Joined: Feb 2006
Posts: 546
Fjord artisan

Fjord artisan
Joined: Feb 2006
Posts: 546 
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: var %expression = 1/(11)
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




Joined: Dec 2002
Posts: 344
Pandimensional mouse

Pandimensional mouse
Joined: Dec 2002
Posts: 344 
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.




Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
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




Joined: Feb 2006
Posts: 546
Fjord artisan

Fjord artisan
Joined: Feb 2006
Posts: 546 
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




Joined: Oct 2004
Posts: 8,330
Hoopy frood

Hoopy frood
Joined: Oct 2004
Posts: 8,330 
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 twovowel 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




Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
Joined: Jul 2011
Posts: 13 
I agree with all but its not explaning why not 0/0=1




Joined: Oct 2004
Posts: 8,330
Hoopy frood

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




Joined: Feb 2006
Posts: 546
Fjord artisan

Fjord artisan
Joined: Feb 2006
Posts: 546 
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




Joined: Feb 2006
Posts: 546
Fjord artisan

Fjord artisan
Joined: Feb 2006
Posts: 546 
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




Joined: Oct 2004
Posts: 8,330
Hoopy frood

Hoopy frood
Joined: Oct 2004
Posts: 8,330 
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^(n1) = a^n/a, so a^(11) = 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




Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
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




Joined: Jul 2011
Posts: 13
Pikka bird

OP
Pikka bird
Joined: Jul 2011
Posts: 13 
on the other way
if x>0 then limes(x/x)=limes(x'/x')=limes(1/1)=1




