4

The documentation says

Chop does not make the real part of machine complex numbers an exact zero:

In[2]:= Chop[10.^-12 + 2. I]

Out[2]= 0. + 2. I

Why does Chop leaves such a useless 0.?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
matheorem
  • 17,132
  • 8
  • 45
  • 115

1 Answers1

7

Complex numbers are atomic in Mathematica. Their real and imaginary parts cannot be separated. Thus both must have the same type: either floating point (inexact) or exact number.

1. is an inexact Real, not Complex. It has no imaginary part. Thus Im[1.] can give 0.

But 2. I is an inexact Complex, which does have a real part even if it's zero. Since this is an exact type, its real part is an inexact zero.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263