Clojure

Incorrect long quot result involving Long/MIN_VALUE

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Triaged

Description

user=> (quot Long/MIN_VALUE -1)
-9223372036854775808

Similar issue to CLJ-1222 and CLJ-1253, with the same root cause as described for CLJ-1225. Ticket filed separately from CLJ-1253 for long division / because the desired fix may be quite different in this case.

Rich Hickey stated in a comment on CLJ-1225 that this case should throw an exception.

Question: For inc (which throws when given input Long/MAX_VALUE) there is an auto-promoting inc' and an unchecked-inc. quot now throws an exception in this case. Should there be an auto-promoting quot' and an unchecked-quot?

Activity

Andy Fingerhut made changes -
Field Original Value New Value
Description {code}
user=> (quot Long/MIN_VALUE -1)
-9223372036854775808
{code}

Similar issue to CLJ-1222 and CLJ-1253, with the same root cause as described for CLJ-1225. Ticket filed separately from CLJ-1253 for long division (/) because the desired fix may be quite different in this case.
{code}
user=> (quot Long/MIN_VALUE -1)
-9223372036854775808
{code}

Similar issue to CLJ-1222 and CLJ-1253, with the same root cause as described for CLJ-1225. Ticket filed separately from CLJ-1253 for long division / because the desired fix may be quite different in this case.
Alex Miller made changes -
Labels math
Andy Fingerhut made changes -
Attachment clj-1254-v1.txt [ 12242 ]
Andy Fingerhut made changes -
Patch Code and Test [ 10002 ]
Andy Fingerhut made changes -
Description {code}
user=> (quot Long/MIN_VALUE -1)
-9223372036854775808
{code}

Similar issue to CLJ-1222 and CLJ-1253, with the same root cause as described for CLJ-1225. Ticket filed separately from CLJ-1253 for long division / because the desired fix may be quite different in this case.
{code}
user=> (quot Long/MIN_VALUE -1)
-9223372036854775808
{code}

Similar issue to CLJ-1222 and CLJ-1253, with the same root cause as described for CLJ-1225. Ticket filed separately from CLJ-1253 for long division / because the desired fix may be quite different in this case.

Rich Hickey stated in a comment on CLJ-1225 that this case should throw an exception.

Question: For inc (which throws when given input Long/MAX_VALUE) there is an auto-promoting inc' and an unchecked-inc. quot now throws an exception in this case. Should there be an auto-promoting quot' and an unchecked-quot?
Alex Miller made changes -
Approval Triaged [ 10120 ]
Andy Fingerhut made changes -
Attachment clj-1254-2.diff [ 12482 ]
Andy Fingerhut made changes -
Attachment clj-1254-v1.txt [ 12242 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: