We're updating the issue view to help you get more done. 

Wrong numeric result from Math/abs on Java 8

Description

This is with Java 1.8 (Oracle or Open JDK):

1 2 3 4 5 6 weird-abs.core=> (Math/abs -10000000000000) 10000000000000 weird-abs.core=> (def a -10000000000000) #'weird-abs.core/a weird-abs.core=> (Math/abs a) 1316134912

In Java 1.7, the expected results are returned instead (10000000000000).

Cause: It appears that Math.abs(int) is being invoked. Both the int and long versions are considered by the reflector but Java 1.7 and 1.8 return these signatures in different orders and the first one found is picked.

Workaround: Use hint or cast to inform the reflector which one to pick.

Environment

does not seem specific to Clojure version
occurs only in Java 1.8

Status

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

None

Patch

None

Affects versions

Release 1.8

Priority

Major