LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about Coercion dot

Hi, Coercion dot is used to convert ond data type to another. Do we need to avoid using it? If we try to avoid using it, will the program speed up a little bit and save some memory? Thanks.
Message 1 of 3
(7,535 Views)
A coercion dot in not inherently bad and pretty much equivalent to an explicit coercion using one of the conversion functions. Sometimes, you need them but their use should still be minimized to the absolutely necessary.

You should pay close attention to coercion dots, because often things can be improved. For example if you are not careful, multiple coercion steps can occur in sequence, while with an explicit conversion you can be more selective to make sure it only occurs once. (For example, if we need to divide five different DBLs by N in a loop, it is probably more efficient to convert N to DBL right away instead of having a seperate coercion at each division operation.)

Many time, you can also rearrange operations to minimize coercions.

They also alert you that your chose datatype may not be optimal or appropriate for a certain function.

It is always best to avoid coercions/conversions. Choose a proper data type from the beginning if at all possible.
Message 2 of 3
(7,527 Views)
I'll add that it is almost impossible to avoid coercion dots in the latest versions of LabVIEW as a typedef is now viewed as different than its underlying type, i.e. a typedefed U32 will show a coercion dot when wired to an input that expects a "raw" U32. I'm not sure what resource impact this has on the executing VI, but it does make looking for those really "bad" coercions mistakes (like wiring a Sngl to a U16) harder to spot. The other problem with coercions is that sometimes the result of the coercion is not what you expected, so trying to spot those dots becomes more important and now with typedefs showing up "dotted" it becomes harder.


Putnam Monroe
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 3
(7,512 Views)