1
$\begingroup$

I have this:

deltaLAB = {-0.00079044, -0.00093133, -0.00104750, -0.00082373, \
-0.00049044, -0.00010956, -0.00044090, -0.00015910, -0.00044090, \
-0.00020864, -0.00007627, -0.00052373, -0.00007627, -0.00052373, \
-0.00014585, 0.00001982, 0.00016071, 0.00009453, -0.00012920};
SetAccuracy[deltaLAB, 2]

and I get this:

{0.*10^-4, 0.*10^-4, 0.*10^-3, 0.*10^-4, 0.*10^-4, 0.*10^-4, 0.*10^-4,
  0.*10^-4, 0.*10^-4, 0.*10^-4, 0.*10^-5, 0.*10^-4, 0.*10^-5, 
 0.*10^-4, 0.*10^-4, 0.*10^-5, 0.*10^-4, 0.*10^-5, 0.*10^-4}

How see only 0 instead of (0.*10^-4)?

Thank you very much!

$\endgroup$
4
  • 8
    $\begingroup$ Use Chop. For Example : Chop[deltaLAB, 10^-2] $\endgroup$ – Lotus Jun 1 '18 at 9:45
  • 4
    $\begingroup$ Or Threshold. $\endgroup$ – Henrik Schumacher Jun 1 '18 at 9:58
  • 6
    $\begingroup$ Note Chop will give the integer 0 and Threshold will give the machine real 0.. For data, Threshold is probably better since it will keep a packed real array both packed and real. $\endgroup$ – Michael E2 Jun 1 '18 at 14:07
  • $\begingroup$ Related: 94907 , 125324. Given the alternatives discussed in this comments, probably this question deserves a canonical answer. $\endgroup$ – rhermans Jun 1 '18 at 14:47
3
$\begingroup$

You can use Round to get 0 only

$\endgroup$
1
  • 4
    $\begingroup$ This works only if all the numbers are close to zero, in which case one could just multiply by 0 to get an array of zeros. If not all the numbers are close to zero, then some will have their values changed as well. $\endgroup$ – Michael E2 Jun 1 '18 at 13:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.