Vectorizing SIUnitsOf over array containing NaN
- November 4, 2024
- 1 reply
- 1113 views
Whenever I think I might be making progress, I hit something that causes me to scratch my head slightly.
This time, it's one of NaN's apparent idiosyncrasies.
SIUnitsOf returns NaN when applied to mixed unit matrices, which is somewhat limiting.
So, having spent a few happy moments programming Yet Another New Version of a function, this time SIUnitsOf, I was reasonably happy with its behaviour.
Then I thought I ought to keep my hand in writing Express-friendly functions and sort of succeeded.
I say "sort of" because I noticed an anomaly: vectorizing SIUnitsOf over a mixed-unit matrix with a pure NaN threw in a spare unit where none was supposed to be.

I've played around with various positions of NaN within the matrix, and it looks as though SIUnitsOf returns the unit of the first element to the NaN under vectorization.
The first question is clearly, "Is this 'anomaly' to be expected?", in which case, what am I not understanding? If it is unexpected behaviour, is it a bug?
Mathcad Prime 10 worksheet attached. I've checked in Mathcad Prime Express 7, and the same behaviour is evident.
Stuart

