stat("Kill/death ratio: [usr.kills/usr.deaths]")
Problem description:
How do i do THAT!? I may fail at maths but HEY...
I get a runtime error whining about "dividing by zero"
If it has to divide 0 by 0 it should be 0. not error -.-
ID:141124
Jun 18 2009, 5:50 am
|
|
Code:
stat("Kill/death ratio: [usr.kills/usr.deaths]") Problem description: How do i do THAT!? I may fail at maths but HEY... I get a runtime error whining about "dividing by zero" If it has to divide 0 by 0 it should be 0. not error -.- |
In response to Schnitzelnagler
|
|
What Schnitzelnagler said.
One way to solve your problem is to make sure that your denominator never becomes zero - which can be done using max(1,...) |
In response to GhostAnime
|
|
GhostAnime wrote:
What Schnitzelnagler said. This is bs. since when is 0 / 0 NOT 0? United as one. Divided by zero. |
In response to Gogeta126
|
|
Um, it has been like that much longer then you have lived?
Use your calculator to do 0/0 or X/0 (X = anything), it'll give you error. You'll learn the whole reason why /0 = undefined when you take calculus. What you are thinking of is 0/1 = 0; 0/0 != 0. Ask your math teacher as well if you don't believe us and you do not believe your calculator's answer "ERROR" |
In response to GhostAnime
|
|
HEY. When i was born there was no internet - and no girls on it.
So what do you suggest i do in the case when both stats are 0? |
In response to Gogeta126
|
|
I told you in [link] (and in case you are still wondering what to do - look up the procedure shown).
|
In response to Gogeta126
|
|
Gogeta126 wrote:
since when is 0 / 0 NOT 0? Since forever. It's simply an operation that doesn't exist; you can't divide something by 0. Try taking an apple and dividing it into 0 pieces. Not possible. Trying to divide something by 0 is an undefined operation, it's similar to telling Dream Maker to execute the procedure blarghkatakitikataka() (when it doesn't exist). Besides, by usual simple math rules when you divide a number by itself, you always get 1, 10/10=1, 3/3=1 etc, so why are you saying 0/0 equals 0? The truth is that a number divided by 0 doesn't equal anything, it doesn't have an actually determinable value. At least not as far as current age math is concerned. |
In response to GhostAnime
|
|
oh mislooked.
Got it. Thanks. Damn.... i never divided anything by 0 so i didnt know its not possible :O |
In response to Kaioken
|
|
Kaioken wrote:
Gogeta126 wrote: Just... Dont divide it? 0.o |
In response to Gogeta126
|
|
Then you'd have 1 apple, thus 1 piece. It's not possible.
0/1 = 0 1/0 = ERROR 0/0 = ERROR 1/1 = 1 |
In response to Mysame
|
|
Mysame wrote:
Then you'd have 1 apple, thus 1 piece. It's not possible. Oh come on. if you have 1 apple and divide it in 0 pieces u will still have 1 whole apple. If you have 0 apples and divide into 0 apples.... who invented maths? |
In response to Gogeta126
|
|
Math is LOGIC, not your own impression of things.
According to your logic, dividing an apple in 1 piece = 1 apple. Dividing an apple into 0 pieces = 1 apple. If you accept this, 1=0. Again, math is LOGIC, and it wasn't "invented", it came to be. If you don't understand it, fine, but leave it, it's obviously stuff way beyond your comprehension. |
In response to Gogeta126
|
|
Gogeta126 wrote:
if you have 1 apple and divide it in 0 pieces u will still have 1 whole apple. Huh? No. You'd have that with subtraction. 1 whole apple is one piece (the original one at that), so no division took place at all (since you didn't try to divide by 1), naturally, since it's not possible. If you divide by any number other than 1, the result should change. |
Yes, I'm sorry to say, but you do.
Division by zero is tricky businesses.
And no, zero divided by zero should by no means yield zero.