cancel
Showing results for 
Search instead for 
Did you mean: 

A Question About Indexing With Nulls

erik_friis
New Contributor
Nulls under the cover must be treated as a "special value" in that you cannot do arithmetic on them, but interestingly enough you can do comparisons--where 0N is treated as the smallest number even less than -0W (0N < -0W).  Is this by definition or based on the internal representations of 0N and -0W and a straight "less than" operation is being done under the covers?  I know 0N and 0n are represented by NaN, but I'm not sure if the processor is capable of doing arithmetic/comparisons with NaNs.

This leads to my next question which is indexing with nulls.  I know a null is always returned when you index into a list with a null, but again does the interpreter special case the null or view it as a really small number, under-indexing the list, and returning a null?

I'm assuming since you can do arithmetic on infinities, that indexing with 0W and -0W is equivalent to indexing with a very large and very small number and thus nulls are returned in this case.

Thanks for any insight.
1 REPLY 1

charlie
New Contributor II
New Contributor II
indexing outside of domain results in null