If I'm writing a game I don't really care if one of many operations accidentally resulted in NaN I would like to treat NaN like SQL treats NULL: pretend it doesn't exist. I can't glean useful information out of it, might as well try to get something from the rest of the data.
Then again according to float semantics, sum of a list containing NaN must be NaN, so it would make sense to extend that principle to min/max.
But the naive implementation of min/max will never output NaN because NaN always compares false. (... unless NaN is the first element. ugly.)
Maybe making it explicit would be best: Make an explicit fn for float collections that filters out NaN in an Iterator, then claim that Item is totally ordered. I'm too much of a rust noob to know if this is possible. (playground here I come!)
Then again according to float semantics, sum of a list containing NaN must be NaN, so it would make sense to extend that principle to min/max.
But the naive implementation of min/max will never output NaN because NaN always compares false. (... unless NaN is the first element. ugly.)
Maybe making it explicit would be best: Make an explicit fn for float collections that filters out NaN in an Iterator, then claim that Item is totally ordered. I'm too much of a rust noob to know if this is possible. (playground here I come!)