The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: In Range and Coerce

SercoSteveB
Active Participant

What is Boolean Array Out following execution of the VI?

In Range and Coerce 05_01_2015.png

In Range and Coerce Answers 05_01_2015.png

Comments
Thoric
Trusted Enthusiast

I know there are odd rules when using floats in the coerce function, but from memory and a process of elimination I'm guessing D.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


jonaslindner
Member

D

Naveensoliton
Member

D

crossrulz
Knight of NI

D


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
LordNobady
Member

D


Learning LabVIEW since January 2013
SercoSteveB
Active Participant

Hi Thoric.  Can you point us at those odd rules?

Thoric
Trusted Enthusiast

SercoSteveB wrote:


                       

Hi Thoric.  Can you point us at those odd rules?


                   

Wow. Now you're asking. Hmm. It was a shadowy memory of some past confusion with In Range and Coerce when using DBLs vs INTs. Thinking harder now I believe it was youthful ingorance that the Coerce ignores the diamonds, which define whether the limits are inclusive or exclusive. The diamonds only influence the In Range? output.

For example, in the following snapshot, it's clear why the In Range is true when the upper limit is inclusive and false when exclusive, but as a LV noob (many years ago now) I think I'd expected the coerced value for the upper to be 5, not 6. Afterall, when the upper limit is excluded it can't allow 6, so it should be coerced down to 5, right? Reading the help it's clear that the coerce is not influenced by the diamonds, but as a newcomer to LabVIEW I'd not expected this behaviour.

coerce.png

It's precisely because using DBLs (floats) makes this area very murky that the function ignores the include/exclude setting. Afterall, if these were floats and you excluded the upper limit of 6, what would you coerce the numeric to? 5.9? 5.99? 5.9999999? It can't be satisfied, so better to just use the range limits inclusively.

Great blog BTW Steve

Thoric (CLA, CLED, CTD and LabVIEW Champion)


MrStevenUND
Member

D

SercoSteveB
Active Participant

Nice explanantion thanks.  I see where you are coming from.  I must admit it had never occurred to me to think about it like that.  Ignorance really is bliss.

It will make a really good 'The Daily CLAD' question though.....

nik35324
Member

D

ciprian
Member

d

mini09
Active Participant

D

kirthika101
Member

D

SercoSteveB
Active Participant

Answer: D.  Nice one Thoric, jonaslindner, Naveensoliton, crossrulz, LordNobady, MrStevenUND, nik35324, ciprian, gnshmrthy & kirthika101.

Great input into this one, thanks Thoric.

A.Bernau
Member

D

SUYAM
Member

D i tried options in this palette

sac0071
Member

D

Gururaj85
Member

Best question. I didn't know in range function has these sub types.

M.P.Bharghavi
Member

Ans:D

{F,T,F,T}