11-01-2014 06:50 PM - edited 11-01-2014 06:53 PM
While Playing around with this, I noticed that "Boolean array to number" has a right-click option for the sign extension mode.
For some reason these options are not explained or described anywhere in the help. In fact, some of the statements in the help depend on the sign extension mode setting and are thus probably not always correct. I would say this is a decumentation problem and should be fixed.
11-03-2014 02:48 PM
Hi Altenbach,
Thanks for bringing this up. CAR 402163 is targeted toward fixing this in the LabVIEW help.
Best Regards,
Nathan Burke
Product Support Engineer | LabVIEW R&D
11-03-2014 09:31 PM - edited 11-03-2014 09:37 PM
I know I can help make sure your problem, but it is an issue I do not understand why I'm following this topic.
good work.
02-07-2015 09:11 PM - edited 02-07-2015 09:18 PM
I was searching for help for this "Sign Extension Mode" option and stumbled upon this post. I still couldn't find any help document regarding this, and I will mention what I understood regarding this. Before that, I need to mention about the output representation option in "boolean array to number" function.
Its not easy to set the output data type for the "boolean array to number" function (by default it is U32) - We currently need to go to properties dialog box for this(as below).
It would be good to have it directly in the right click menu, like we have for numeric terminals.
As I didn't find any help document for the "Sign Extension Mode", here goes what I understood(for others who might stumble on this topic)
Sign Extension Modes:
Never - There is no sign bit in the boolean input array. All elements of the boolean array refer to the digits of the number, including the last element of the boolean array(which is the MSB bit).
If Output Is Signed(default) - The usage of MSB bit for sign, will depend on the output representation(currently in the "Properties" window of the boolean array to number" function). If the representation is unsigned(like U32), there is no sign bit. If the output representation is signed(like I32), the MSB is a sign bit.
Always - The MSB(last element in boolean array) always represents the sign bit, with the rest of the elements in the boolean array representing the digits of the number.
02-08-2015 12:53 PM
@Karthik_Abiram wrote:
Never - There is no sign bit in the boolean input array. All elements of the boolean array refer to the digits of the number, including the last element of the boolean array(which is the MSB bit).If Output Is Signed(default) - The usage of MSB bit for sign, will depend on the output representation(currently in the "Properties" window of the boolean array to number" function). If the representation is unsigned(like U32), there is no sign bit. If the output representation is signed(like I32), the MSB is a sign bit.
Always - The MSB(last element in boolean array) always represents the sign bit, with the rest of the elements in the boolean array representing the digits of the number.
This explanation is incomplete. The sign extension mode indicates what happens in the upper bits of the output integer when the input boolean array contains fewer values than there are bits in the output. Integers are represented using the 2's complement system; there is no "sign bit." When the value is signed, the most significant bit does indicate the sign of the value, but flipping that bit does not result in the negation of the original value. Please read about the 2's complement system. I wrote an explanation the sign extension modes here:
http://forums.ni.com/t5/BreakPoint/LabVIEW-Minutiae-that-may-bite-you-someday/m-p/2367608#M22707
02-08-2015 08:02 PM
Thanks Nathand, I didn't know that.