Ad
  • Default User Avatar

    I'm stuck on this with Swift. My code passes all tests except for very large numbers apparently:

    Full Tests
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 35875699062250035
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 4498128791164624869
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 4929273885928088826
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 21897142587612075
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 1517841543307505039
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 35641594208964132
    XCTAssertEqual failed: ("true") is not equal to ("false") - Should return true for 3289582984443187032

    When I logged my output I saw that I have rounding errors, for example:
    9 ^ 19 = 1350851717672992089

    But Swift returns 1350851717672992000

    Has anyone had the same problem? Any tips?