Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3131

String(someDouble) incorrectly switches to scientific notation for large integers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Standard Library
    • Labels:
      None
    • Environment:

      Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
      Target: x86_64-apple-macosx10.9

      Description

      The string representation of a Double incorrectly uses scientific notation for large integers that are still within the range that can be precisely represented using a Double. This happens at some point between 1 << 49 and 1 << 50.

      Example:

        1> Double(1 << 50)
      $R0: Double = 1125899906842624
        2> Double(1 << 50).ulp
      $R1: Double = 0.25
        3> print(Double(1 << 50))
      1.12589990684262e+15
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tbkka Tim Kientzle
              Reporter:
              lily Lily Ballard
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: