Completed
Details
Assignee
UnassignedUnassignedReporter
importimportLabels
Approval
OkPatch
Code and TestPriority
TrivialFix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
import
importLabels
Approval
Ok
Patch
Code and Test
Priority
Fix versions
Created March 7, 2014 at 8:36 AM
Updated September 6, 2017 at 5:42 PM
Resolved September 6, 2017 at 5:42 PM
Would expect both of these to return NaN but first does not:
Cause: Here we are dividing a double by a long. In the first case, this is parsed as divide(Object, long) which then calls divide(Object, Object), which throws ArithmeticException if the second arg is 0 (regardless of the first arg).
In the second case it's parsed as divide(double, long) which just relies on Java to properly upcast the primitive long to a double to do the divide.
Note that making this call with 2 doubles does return NaN:
or type hinting x to a double works as well:
Proposed: Add checks in divide(Object, Object) to check whether x is NaN and instead return NaN.
Patch: clj-1371-2.patch
Prescreened by: Alex Miller