JKI Discussion Forums
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Issue with comparing 1D double array's Rate Topic: -----

#1
User is offline   WG- 

  • Group: Members
  • Posts: 11
  • Joined: 21-November 10
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?
0 kudos

#2
User is offline   crossrulz 

  • Group: Members
  • Posts: 3
  • Joined: 30-April 10

View PostWG-, 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.
0 kudos

#3
User is offline   WG- 

  • Group: Members
  • Posts: 11
  • Joined: 21-November 10
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?
0 kudos

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic