I was just creating a unit tests which compares to 1D arrays of doubles with each other. But it fails all the time while the data is actually equal to each other... Are there any issues now about comparing 1D double array's?
JKI Discussion Forums
Page 1 of 1
Issue with comparing 1D double array's
#2
Posted 17 April 2012 - 02:06 PM
WG-, on 17 April 2012 - 01:38 PM, said:
I was just creating a unit tests which compares to 1D arrays of doubles with each other. But it fails all the time while the data is actually equal to each other... Are there any issues now about comparing 1D double array's?
This sounds more like an issue with comparing doubles. Remember that doubles (floating points in general) are not exact. If you are performing an equals with doubles, you will likely fail. Instead you should be checking for the doubles being within an accuracy range.
#3
Posted 17 April 2012 - 02:47 PM
Hmm yes I know but you mean to say when I divide 5 by 2 in native labview which would result in 2,5 may not be equal to 2,5 when I write it as a double constant?
Share this topic:
Page 1 of 1




Back to top








