LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
MGiacomet

Numeric "divide" operator should not upcast to a double

Status: Declined
The divide node in LabVIEW means real-number division. The Quotient & Remainder node does integer division. LabVIEW has two different symbols for these two very different behaviors precisely to avoid the ambiguity of a single symbol observed in other languages.

All the simple Numeric operators (add, subtract and multiply) do not show red dots when you wire, say, two integers. "Divide" does, but should not! The Divide operator coerces everything to a double!...

 

In all other languages, if you use the divider operator (the slash /) it conforms to the operands passed: divide a double by a double and you get a double; divide integer by integer and you get an integer.

 

Please make the Divide operator not upcast to a double!

4 Comments
GregR
Active Participant

The "Quotient & Remainder" node does have this behavior. Personally, I think that makes the behavior more clear. You can see that the remainder is being ignored.

dthor
Active Participant

I would definitely not like it if dividing two I32s resulted in an I32. That's one of the tiny things about labview that I love: I don't have to explicitely coerce up to DBL like some other langues.

altenbach
Knight of NI

The current behavior is fine. You can change the output configuration of you really want something else.

MaryH
Member
Status changed to: Declined
The divide node in LabVIEW means real-number division. The Quotient & Remainder node does integer division. LabVIEW has two different symbols for these two very different behaviors precisely to avoid the ambiguity of a single symbol observed in other languages.