Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143896

java.lang.Long is implicitly converted to double

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • core-libs
    • None
    • b102
    • generic
    • generic

        This bug was reported by Tomas Hurka via mail.

        On JDK 8, calling Long.valueOf("301077366599181567") and converting the result to string seems to convert the number to double since the result shows a loss of precision.

        nashorn> java.lang.Long.valueOf("301077366599181567").toString()
        301077366599181570

        If toString() would have been called on the java.lang.Long instance, the result should not loose precision and be the same as the input string.

              hannesw Hannes Wallnoefer
              hannesw Hannes Wallnoefer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: