Floating point problems in C and Matlab
Hey there, I have floating point problems in my matlab-mex file where I get values at the magnitude 10^(-12) to 10^(-13)... Is there an 'dirty' way to solve them to at least set those values to zero after the computation if they are so small? Thanks!
If it's an array, you could do something like:
small_inds = find(abs(array) < 10^-12); array(small_inds) = zeros(length(small_inds),1);
(edited to add abs() for clarity—thanks nimrodm)