I am trying to filter an array with different elements in using an if statement. So far i have if ( a < 0.001 ) a = 0 which works but i have minus values in the array which i wish to keep. Therefore it would be ideal to have an if statement that said for example if (a = (between 0.000592654 and 0.000592655) a = 0.
I have tryed loads of things but cannot get it to work.
a = (sin(pi*(i*b)/180));
if ( a == 0.000592654 )
a = 0;
cout << a;
The code above is just one way i have tryed which dosnt work because as soon as the value = 0.000592654 is met the rest of the elements after it go to 0. If there is some way of stating if the array is between X and Y output a 0 only