Wat zou de uitkomst van 0 / 0 in een programmeertaal moeten zijn?
Wiskundig gezien, is iedere uitkomst waar (0 / 0 = 493 --> 493 * 0 = 0)
Wiskundig gezien, is iedere uitkomst waar (0 / 0 = 493 --> 493 * 0 = 0)
Geen getal | 6 | 17% | |
---|---|---|---|
Divide by zero-foutmelding | 17 | 49% | |
Oneindig | 3 | 9% | |
0 | 6 | 17% | |
1 | 1 | 3% | |
een willekeurig getal | 2 | 6% | |
35 stemmen |
Nieuwste reacties:
gna, 16 oktober 2007 15:28
but for example, in game programming you want the arctan of dy/dx to get the angle. There i would like to have the option to get 0 as outcome, it sucks to have to do a try catch or to check if the outcome isNaN only for the rare case that 2 objects have the same position. Then i would manually set the angle to 0 anyway
Necrathex, 16 oktober 2007 10:47
In a programming language you'd never put a literary 0/0 in the code, it will mostly be some variable divided by some other variable (a/b); therefore whenever b = 0 there should be a division by zero error, regardless of the value of a.
gna, 15 oktober 2007 23:25
added 1 as an option, i can image people would vote that because x / x is always 1 except for 0 or (-)infinity
gna, 15 oktober 2007 15:16
most often i would rather have 0 as the outcome, than to get an error message...