LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI of the Day (9/3/2009)


altenbach wrote:

I32 does not have NaN! What do you suggest? Make the output an array with zero or one I32 elements? Empty array for "not found"? Add an error output that goes high for "not found"? Not satisfactory!

 

Message Edited by altenbach on 09-03-2009 11:57 AM


I've put my toe in the water enough to know that people love their '-1'.  I have an ingrained, almost compulsive disdain for literal constants, so that is why I shudder at the thought of a comparison to '-1'.  In my personal toolkit I use the largest negative I32 in the form of a read-only global to signify no match in my binary search implementation.  I also have a boolean output to signify no match, but never really use it.  When using built-in functions, I stick to less-than-zero comparisons, or wire the output index directly to index array so that -1 never sees the light of day.  Neither construct would be affected by choosing a different sentinel value.  To each their own.

 

 

0 Kudos
Message 11 of 17
(1,066 Views)

Darin.K wrote:
I've put my toe in the water enough to know that people love their '-1'. To each their own.

Perhaps it's actually to you your own. Smiley Very Happy

 

Just kidding, of course. 

 

Maybe. 

0 Kudos
Message 12 of 17
(1,059 Views)

Darin.K wrote:

In my personal toolkit I use the largest negative I32 in the form of a read-only global to signify no match in my binary search implementation. 


This is not future-proof! Especially with  64bit LabVIEW, arrays with 2^31 elements are easily possible.

So you are sacrificing a perfectly good number if there are plenty of negative numbers available that are unused! 😉 

0 Kudos
Message 13 of 17
(1,050 Views)

smercurio_fc wrote:


Perhaps it's actually to you your own. Smiley Very Happy



"Individuality is either the mark of genius or the reverse. Mediocrity finds safety in standardization."

-Frederick E. Crane

 

Message 14 of 17
(1,045 Views)

altenbach wrote:

This is not future-proof! Especially with  64bit LabVIEW, arrays with 2^31 elements are easily possible.

So you are sacrificing a perfectly good number if there are plenty of negative numbers available that are unused! 😉 


I'll have my quantum computer built before I have 20 Gb RAM to start throwing around DBL arrays of that size!  After past upgrades, I don't take it for granted that one LV version will be compatible with the next so I never look too far in the future.  Besides why is the largest negative number any more susceptible than -1?

Message Edited by Darin.K on 09-03-2009 03:20 PM
0 Kudos
Message 15 of 17
(1,037 Views)

Darin.K wrote:

Besides why is the largest negative number any more susceptible than -1?


Sorry, I misread your post.

 

Still, the largest negative integer is -1, right? We're on the same page after all! 😄

Message 16 of 17
(1,031 Views)
D'oh! When I am finished smacking myself in the head I'll probably come around to your way of thinking...
Message 17 of 17
(1,027 Views)