09-03-2009 02:33 PM
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.
09-03-2009 02:40 PM
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.
Just kidding, of course.
Maybe.
09-03-2009 03:01 PM
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! 😉
09-03-2009 03:06 PM
smercurio_fc wrote:
Perhaps it's actually to you your own.
"Individuality is either the mark of genius or the reverse. Mediocrity finds safety in standardization."
-Frederick E. Crane
09-03-2009 03:19 PM - edited 09-03-2009 03:20 PM
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?
09-03-2009 03:22 PM
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! 😄
09-03-2009 03:24 PM