Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Result of Division of 0 by 0
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01189726
Message ID:
01189797
Vues:
8
>>x = 0
>>y = 0
>>
>>z = x/y
>>
>>z > 0 = .F.
>>z < 0 = .T.
>>z < -1 = .T.
>>z < -9999999 = .T.
>>
>>It's a numeric field but can't be displayed (maybe its negitive infinity?). From a mathmatical standpoint - you can't divide by zero anyway - its supposed to be impossible. I'm suprised VFP doesn't give an error when you try to do that. Anyway I've always just checked for the possibilty in my code where I need to.
>
>
>I don't know why VFP doesn't throw divide-by-zero errors. I do know you get the equivalent of Field Overflow and a number that can't be used. I do know that I used to have DIVIDEBY() functions which trapped the denominator and returned 0 for DIVIDEBY(x,0)
>
>
>My first language was APL where 0/0 was (IIRC - it was a long while ago) defined as 1 where other languages defined it as 0 (rather than error). The arguements about the "correct" return value for 0/0 went something like
>
>0/x is 0 therefore 0/0 is 0 and not an error
>
>x/x is 1 therefore 0/0 is 1 and not an error
>
>x/0 is an error therefore 0/0 is an error
>
>I have no idea which is "correct." I justs live with however the language implements it.

Yeah its one of those "is the glass half full or half empty?" type of things. Perhaps the glass is just twice as big as it needs to be.

Division by zero is an operation for which you cannot find an answer, so it is disallowed. You can understand why if you think about how division and multiplication are related.
12 divided by 6 is 2 because
6 times 2 is 12

12 divided by 0 is x would mean that
0 times x = 12

But no value would work for x because 0 times any number is 0. So division by zero doesn't work.

- Doctor Robert


....if you really want the scoop on divide by zero you can read this:
http://en.wikipedia.org/wiki/Division_by_zero
ICQ 10556 (ya), 254117
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform