Divided by Zero

Divided by Zero

output(1 / 0);

What should the program output ?
NaN ? Error ?

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

I think "error, division by zero, line 1"

Agreed, or something similar. However, there some other cases:var x = 1/0; // produce error here?output(x); // or here?var x = pow(10,pow(10,100)); // INF error here?output(x); // or here?

Quoting john_e_lilley
Agreed, or something similar. However, there some other cases:var x = 1/0; // produce error here?output(x); // or here?var x = pow(10,pow(10,100)); // INF error here?output(x); // or here?I think in first step in first and second examples

Judges, do you have a preference that NaN and Inf numbers be detected at evaluation time, or at output time?

Connectez-vous pour laisser un commentaire.