[xquery-talk] Literal NaN
matthias.brantner at 28msec.com
Fri Feb 25 16:41:08 PST 2011
What a coincidence, I was just about to ask the same question. ;-)
> I’m wondering why this hand-standing ? Why cant I compare to NaN directly ?
> Is there no literal constructor for NaN ? I cant find any … and my obvious attempts fail like
> If( number(“abc”) eq NaN ) …
> Its just strange to me to have a value which can be returned by a function which you cant construct …
> Or have to use conversion to string , or maybe something equally obtuse
> number(“NaN”) eq number( non-numeric-value )
You could construct it using xs:float("NaN"). However, the result of xs:float("NaN") eq xs:float("NaN")
is false (which makes sense).
Hence, I would also vote for introducing a function is-nan($n) to do this check (unless I'm missing
More information about the talk