LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Darin.K

Numeric conversions should accept boolean inputs

Status: New

My LV intellisense prototype has been telling me something very interesting recently.  When I use it on a Boolean to 0,1 node, it really, really thinks I want to put in an I32 numeric conversion.  Looking deeper, almost everytime I forgo the I32 conversion I am utilizing an implicit coercion.  What I have not wanted, probably since the LV4 days is an I16. 

 

The following suggestion is a marginal improvement:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Change-Output-Representation-on-quot-Boolean-to-0-1-qu...

 

I like output configuration myself, but it can be easily hidden from beginners, and not-quite-beginners alike:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-Output-Configuration-for-the-Compound-Arithmetic...

 

And teaching people about it is not enough sometimes: Smiley Surprised

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Output-Configuration-for-Add-Multiply-Array-Elements/i...

 

So I suggest skipping the middle man and allowing the numeric conversion functions to accept booleans directly.  So simple even a text programmer can do it.

 

BooleanConversion.png

 

14 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

Hmmm, runs twice as fast in half of the time...

Does it mean it runs at the same speed during the same time?

Darin.K
Trusted Enthusiast

It means the code runs twice as fast (combining operations under the hood), and I code it in half of the time (dropping one node instead of two).

raphschru
Active Participant

Who's watching this in 2021 ?

 

I just found another use for the requested feature.

Since the numerical conversion functions also accept combination of clusters and arrays, it would be really useful to convert complex data structures all at once.

 

The strange thing is, while the wire is broken, type adaptation still works great:

raphschru_1-1620345846057.png

 

Instead I need to unbundle everything, convert all values excepted the boolean, then bundle everything:

raphschru_2-1620346218878.png

I sometimes have really big clusters coming from FPGA, where I cannot use booleans because it prevents easy conversion.

 

 

AristosQueue (NI)
NI Employee (retired)

> Who's watching this in 2021 ?

 

I still am despite not being in R&D anymore, and I push things to the team as they come up. This idea remains in the backlog of reasonable ideas LV could adopt, but developers and time are both finite quantities, and this one has never quite tipped the priority scales.