LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In Range & Coerce not passing coerced LV2020

Forgot to mention - wire Array Size to the upper limit of the In Range & Coerce.

 

Comparision mode is "compare elements", "Include upper limit" is unchecked, when I wire a number (e.g. 8 to the upper limit, the coerced output is 8.  I was expecting 7 since I have Include upper limit unchecked. 

 

Observed this is prior LV version too, I search the forum didn't see the problem addressed.  I've always worked around the solution by decrementing (-1) the upper limit.  It appears that checking Include upper limit makes no difference.

 

Has anyone else observe the same issue.

0 Kudos
Message 1 of 13
(1,655 Views)

The "include xxxx limit" options are for the Boolean "in range" output.  They do not affect the output of the coerced number.  If you read the help file this is how it is meant to work.

0 Kudos
Message 2 of 13
(1,628 Views)

This is not what I would have expected, TIL

DerrickB_0-1673386693871.png

 

Message 3 of 13
(1,605 Views)

 


@DerrickB wrote:

This is not what I would have expected, TIL

DerrickB_0-1673386693871.png

 


The last sentence being the important one.

Suddenly,  the VIA test for that makes sense now! 💡

---------------------------------------------
Certified LabVIEW Developer (CLD)
0 Kudos
Message 4 of 13
(1,594 Views)

@DerrickB wrote:

This is not what I would have expected, TIL

DerrickB_0-1673386693871.png


It is actually what I would expect. 😁

 

Admittingly, for integers it would be possible to implement an algorithm that also observes the limit inclusion/exclusion for the coerced value. But how oh how would you want to do that for a floating point value? Sure, the limit minus machine Epsilon might be an answer, but how useful is that???

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 13
(1,542 Views)

Can't say this doesn't bite me every now and then.

 

Using array size -1 fixes everything. 

0 Kudos
Message 6 of 13
(1,535 Views)

Rolf, yeah I know that it wouldn't be able to work that way for floating point and they need to keep behavior consistent across data types. It's just not what I would expect primarily using integers. I rarely use that node with floating point as I usually do want more specific behavior for range control so why use a node that is going to do extra stuff that I'm going to need to do myself anyway.

 

It makes sense but that doesn't mean I have to like it 😄

0 Kudos
Message 7 of 13
(1,499 Views)

Wow, used this "In Range" function for many years and was never aware of the little detail regarding coercion of the Bool output.  I too use the decrement (-)1 to fix the issue.  When I see coercion in the description, I'm thinking numerical integers coercion.

 

Hmmm, I suggest a name change of function, remove the coercion part.  Coercion of a Boolean, not sure if I have much use for that with all the other comparison functions provided.

0 Kudos
Message 8 of 13
(1,443 Views)

Technically it does Coerce, just without observing the selection to include or not the respective limits, as they are always included.

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 13
(1,429 Views)

On a second look at the description, I know why this function threw me out to left field.  The icon description labels the output numeral as "coerce".  Yet the text explicitly says the numeric is not coerce only the bool, (In Range?).  Need to be changed to reflect the instructions.

 

coerced-NoItIsNot.PNG

 

It coerces but the glitch is the check/uncheck box feature, confusing at any first look. Upper limit/lower include or not?  I'd say they are not; the limit check box isn't of much use.

0 Kudos
Message 10 of 13
(1,364 Views)