Comparing two float arrays upto 0.0001 precision [message #93951] |
Sun, 04 December 2016 22:58  |
priyamalik484
Messages: 7 Registered: December 2016
|
Junior Member |
|
|
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!!
|
|
|
Re: Comparing two float arrays upto 0.0001 precision [message #93952 is a reply to message #93951] |
Mon, 05 December 2016 02:38  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
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
|
|
|