min-key and max-key should return NaN if any of the argument is NaN

Description

It appears that min-key and max-key behave incorrectly (following Java that follows IEEE floating point convention):

Not sure how this should then propagate forward, but definitely not silently. Options:

1. [:b NaN] (the first item to generate the NaN)
2. NaN (this is changing the expected type)
3. ArithmeticException Operation with at least one NaN operand.

If this was to be patched the same as it was for min/max (http://dev.clojure.org/jira/browse/CLJ-868) it will probably result in option 1.

Environment

Likely All. Including older version of Clojure.

Activity

Show:
Nicholas Antonov
April 15, 2016, 3:36 AM

This implements the first solution of a contagious NaN in the same style as CLJ 868

Alex Miller
April 15, 2016, 6:03 AM

Patch should have tests...

Nicholas Antonov
April 15, 2016, 7:07 AM

This latest patch adds tests for min-key and max-key with and without NaN results, as there were none before.

Alex Miller
April 29, 2016, 4:06 PM

This overlaps with CLJ-99, which has already been prescreened. I would like to base whatever changes this patch requires over the top of that ticket. To build this, apply the patch, then branch, make you changes, and then create a patch relative to the clj-99 branch. Sorry that's a pain - usually patches don't collide at this level of conflict.

Nicholas Antonov
May 12, 2016, 12:14 PM

The latest patch fixes min and max key in the same way, but based over CLJ-99, only evaluating the function once for each item.

Assignee

Unassigned

Reporter

Renzo Borgatti

Labels

None

Approval

Triaged

Patch

Code

Affects versions

Priority

Minor
Configure