Search code examples
.netlabview

Why is LabView converting decimals into tiny floating point numbers?


UPDATE: It turns out it was just LabView messing up. Even ints weren't coming through properly. Deleting and recreating some of the nodes solved the problem.

I wrote a .Net 3.5 assembly which is being consumed by a LabView engineer. It's at least LabView 7, but I think higher. A method in my assembly is returning an array of objects where each instance has a property of type decimal (among other things). The LabView engineer is doing nothing particular fancy, and is just dumping the sequence to the front-end of the VI, and each of these decimal properties look like very tiny floating point numbers. The actual decimal might be 740.0, but it gets seen in LabView as a double, with a value like 8.12345E-315. That's off by quite a few orders of magnitude!

The string and boolean properties are coming through just fine.

Any idea why this is happening?

EDIT: We tested this using a very simple class with some decimal fields and properties, and it worked perfectly fine in LabView. There's something fishy going on with this one DLL, so we're trying some other tests to see if we can replicate the issue using a different DLL.

Here is a screenshot of some endian-changing tests. Swapping the endian type of the properties of our simple test class produced the same values. Swapping the endian type of the decimals from the real class library just produces different tiny floats.

https://i.sstatic.net/w4qxQ.jpg


Solution

  • Try deleting and recreating the property access nodes. Sometimes LabView gets confused and messes up the data.