01-10-2023 01:32 PM - edited 01-10-2023 01:37 PM
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.
01-10-2023 02:03 PM
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.
01-10-2023 03:39 PM
This is not what I would have expected, TIL
01-10-2023 04:10 PM
@DerrickB wrote:
This is not what I would have expected, TIL
The last sentence being the important one.
Suddenly, the VIA test for that makes sense now! 💡
01-11-2023 02:46 AM
@DerrickB wrote:
This is not what I would have expected, TIL
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???
01-11-2023 03:37 AM - edited 01-11-2023 03:39 AM
Can't say this doesn't bite me every now and then.
Using array size -1 fixes everything.
01-11-2023 10:09 AM
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 😄
01-14-2023 09:42 PM
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.
01-15-2023 04:19 AM
Technically it does Coerce, just without observing the selection to include or not the respective limits, as they are always included.
01-16-2023 04:37 PM - edited 01-16-2023 04:43 PM
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.
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.