LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula node bitwise OR has a bug?

Hello everyone,

 

I am trying to do a bitwise OR with 32 bits in an formula node. It seems that the OR operation produces unexpected results if the most significant bit is set. For example if I do:

0x00000000 OR 0xffffffff I would expect 0xffffffff. Instead I get 0x80000000. In binary this looks like:

 

00000000000000000000000000000000  OR

11111111111111111111111111111111  EQUALS

10000000000000000000000000000000

 

Please see the attached minimal example for comparison of some example values. The output with using blocks is exactly the one I would expect and is also included in the example.

 

I am using Labview Version 14.0f1 on Windows 7 Professional.

 

This might also be in connection with the following currently unresolved bug:

48016
3P7CBB4Q

https://www.ni.com/en/support/documentation/bugs/14/labview-2014-and-2014-sp1-known-issues.html#4801...

 

However that that bug is for unsigned int32 and the suggested workaround is to use signed 32 bit integer, which nevertheless fails in the provided example code.

 

If someone could have a look and tell me if this is a bug or if I am misunderstanding somtheing that would be great. I am already starting to go crazy. 😉

 

Best regards and thanks in advance

 

Saali

 

 

 

0 Kudos
Message 1 of 4
(2,952 Views)

Sorry, can't open even your minimal example as I'm still on 2013.  It sure sounds related to the bug you linked though.  Can you try using the native OR blocks in LabVIEW instead of a formula node as suggested in the link?  They work expectedly in 2013.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(2,934 Views)

Well, yes, it is a documented bug and you even give the link.

 

It has been around forever. See also this disucssion from 2009.

0 Kudos
Message 3 of 4
(2,924 Views)

No, actually this bug is different from what is documented.The documented bug happens with uInt32 and the documentation specifically suggests to use Int32 as a workaround for the known bug:

 

"2. Use signed 32-bit integers instead of unsigned 32-bit integers in the formula node."

 

However this is exactly what fails in my case when I use OR. I thought this might be some valuable information for the people trying to fix that bug. (Which seems to be hard to find, as it has been around so long and screws up very basic operations.)

 

It might also be that NI does not really care for that bug because most people don't use the formula node for basic bit arithmetic. Anyway, I just wanted to put the information out somewhere for the next person who has that problem to find. I  guess the lesson I learned from this conversation is don't trust the formual node to much for doing low-level bit stuff...

 

Best regards

 

Saali

0 Kudos
Message 4 of 4
(2,843 Views)