f



Comparing two float arrays upto 0.0001 precision

Dear all,

I am trying to compare two very long float arrays upto precision 0.0001
without using for loop as it is taking alot time in processing. Can any one 
guide me how to compare two long arrays in float????  

Thanks in advance!!
 
0
priyamalik484
12/5/2016 6:58:08 AM
comp.lang.idl-pvwave 12260 articles. 4 followers. Post Follow

1 Replies
415 Views

Similar Articles

[PageSpeed] 47

On 12/05/2016 07:58 AM, priyamalik484@gmail.com wrote:
> I am trying to compare two very long float arrays upto precision 0.0001
> without using for loop as it is taking alot time in processing. Can any one
> guide me how to compare two long arrays in float????

A=randomu(seed,100000)
B=randomu(seed,100000)
similar=abs(A-B) le 0.0001

Similar is then a byte array that is 1 where A approx B, 0 elsewhere.
If you want instead a list of indices, where A approx B, use

w=where(abs(A-B) le 0.0001,/null)

By the way, avoid using long for anything else than long integers 
(32-bit), otherwise you cause confusion.

I hope this helps, Markus


0
Markus
12/5/2016 10:38:29 AM
Reply: