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

Mismatch between behavior of quotientAndRemainder and docs

    XMLWordPrintable

    Details

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

      Description

      According to https://developer.apple.com/documentation/swift/binaryinteger/3017639-quotientandremainder,

      > A tuple containing the quotient and remainder of this value divided by rhs. The remainder has the same sign as rhs.

      However, running it shows that's not the case:

      $ echo 'print((10 as Int).quotientAndRemainder(rhs: -3))' | xcrun swift
      (quotient: -3, remainder: 1)
      

      Is there an implementation bug here or a documentation bug?

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            theindigamer Varun Gandhi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: