# 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. Sep 13, 2014 at 22:29
• I think you want SameQ (===) i.e. If[a === ComplexInfinity, True, False] Sep 13, 2014 at 22:30
• The title says Indeterminate but the question shows only ComplexInfinity -- do you mean both symbols, or just one, or something else? Sep 13, 2014 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[1] | DirectedInfinity[-1] | Indeterminate :> True Sep 14, 2014 at 0:02