Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
1 rating:
 1 out of 5   

Why Does the To Unsigned Integer Function Show Different Behavior in LabVIEW 2010 and Later Versions?

Primary Software: LabVIEW Development Systems
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: N/A

I just upgraded my VI to a version of  LabVIEW 2010 or later, and using the To Unsigned Integer function to convert the NaN value from a floating-point data type to an integer returns a number rather than returning zero.  Why is this?

In versions of LabVIEW earlier than 2010, when using any of the To Unsigned Integer functions to convert a floating-point data type into an integer, LabVIEW converted the NaN value to zero.

In versions 2010 and later, LabVIEW now coerces the NaN value to the largest available integer number of the specified data type.  For example, using the To Unsigned Quad Integer function returns 18446744073709551615, To Unsigned Long Integer returns 4294967295, To Unsigned Word Integer returns 65535, and To Unsigned Byte Integer returns 255.

Use a Case Structure and the Not A Number/Path/Refnum? function to force LabVIEW to convert NaN to zero in versions 2010 and later.

Related Links:
White Paper: LabVIEW 2013 and 2013 SP1 Known Issues 
LabVIEW Help: To Unsigned Long Integer Function
KnowledgeBase 0LT9HQ38: Comparison of Two NaN Constants Returns FALSE in LabVIEW

To Unsigned

Report Date: 04/14/2014
Last Updated: 04/16/2014
Document ID: 6KDJGMF0

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit