Uploaded image for project: 'ClojureScript'
  1. CLJS-3059

Contrary to their docstrings, long and unchecked-long are not identical to int

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects versions: 1.10.238
    • Fix versions: None
    • Labels:
      None
    • Environment:

      ClojureScript 1.10.520, Node 11.10.0

      Description

      The docstrings for cljs.core/long and cljs.core/unchecked-long say: "Coerce to long by stripping decimal places. Identical to `int'." However, their implementation and behavior differs from cljs.core/int. Some examples:

      x (int x) (long x)
      -5671919744 -1376952448 -5671919744
      ##Inf 0 ##Inf
      "a" 0 ##NaN
      "24248082057" -1521721719 24248082057

      unchecked-long's implementation is identical to long's so the results are the same. The solution I propose is to just drop the claim about identicalness.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              arcatan Miikka Koskinen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: