[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NA & operations with it

From: Daniel Kraft
Subject: NA & operations with it
Date: Thu, 21 Nov 2013 14:08:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0


I just chased a bug in my Octave codes, and found that it was related to
my usage of NA to denote special cases for entries of some data
structures.  In particular, I found that -NA = NaN and not NA again.

So far, so good.  However, I experimented a bit further, and found that
"almost all" other (linear) operations with NA in fact return NA again:

+NA, 0 - NA, 1 * NA, Inf + NA, NaN * NA, and others

So why is just -NA not NA but NaN instead?  Is this a deliberate choice,
or just an edge case no-one has thought about so far?  I take it that
one should probably not rely on any of those (and I changed my code now
accordingly), but it still seems curious to me; and if there was no
actual reason for this behaviour, I would suggest to change it to make
it consistent.  (I can try to provide a patch.)


Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri

reply via email to

[Prev in Thread] Current Thread [Next in Thread]