How to test for Indeterminate values?

I need something like this

a = 101010/0;
If[a == ComplexInfinity, True, False]

But if I use ToString, I get what I want.

a = 101010/0;
If[ToString[a] == "ComplexInfinity", True, False]

Does someone know a better way to do this?, I can't belive that transforming to a string is the only way.

• This question might be interesting for you Max of a table/list with indeterminate values. – Artes Sep 13 '14 at 22:29
• I think you want SameQ (===) i.e. If[a === ComplexInfinity, True, False] – RunnyKine Sep 13 '14 at 22:30
• The title says Indeterminate but the question shows only ComplexInfinity -- do you mean both symbols, or just one, or something else? – Michael E2 Sep 13 '14 at 23:19

For the record, as RunnyKine wrote in a comment

a = 101010/0;
If[a === ComplexInfinity, True, False]
True

is what you are looking for.

you can also try:

a = 101010/0;
If[1/a == 0, True, False]

A generalization could look like this:

{1, 101010/0, 2, 0/0, Infinity, -Infinity} /.
ComplexInfinity | DirectedInfinity | Indeterminate :> True /. True[1 | -1] -> True

{1, True, 2, True, True, True}

• Or ... /. ComplexInfinity | DirectedInfinity | DirectedInfinity[-1] | Indeterminate :> True – Bob Hanlon Sep 14 '14 at 0:02