03-11-2010 05:57 AM
Hi, i have two 1d arrays with 7 elements inputting into a equal? comparison. My question is when the equal compares the two 1d arrays does it compare the entire are array of elements to the other array of elements. Or does compare one element from one array to the other element in that array untill its gone through all the elements.
Stu
Solved! Go to Solution.
03-11-2010 06:17 AM - edited 03-11-2010 06:21 AM
During comparison, it will check the corresponding index values only. So a(0) is compared to b(0) and a(1) to b(1). See the attached sample.
03-11-2010 06:47 AM
Please keep in mind that comparing floating point numbers to "equal" is a bad idea. So do not compare to arrays with floating point numbers with the equal function.
Norbert
03-11-2010 08:53 AM
Mathan wrote:During comparison, it will check the corresponding index values only. So a(0) is compared to b(0) and a(1) to b(1). See the attached sample.
There is more to it than that.
If you right click on the = comparison, there is a a menu choice for Comparison Mode. By default, it is Compare Elements and will return an array of booleans comparing element to element.
If you choose Compare Aggregates, then you will get a single boolean that is a comparison of the complete array to the other array.
So you can get both choices. All you have to do is set the comparison mode the way you want.
03-11-2010 09:37 PM
Dear Stu,
You can better mark Ravens Fan post as solution since it is having very much information than mine.
Thanks,
Mathan
03-12-2010 01:36 AM
hi,
Not sure if this is worth mentioning... when working with two arrays, the arithmetic takes effects up to the shorter one (in size)...
Correct me if above is not correct. Thanks!