- Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
CustomStringConvertibleArea → standard library: The `CustomStringConvertible` protocolArea → standard library: The `CustomStringConvertible` protocolDoubleArea → standard library: The `Double` typeArea → standard library: The `Double` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaArea: Standard library umbrellaunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
| Previous ID | SR-106 |
| Radar | rdar://problem/40565639 |
| Original Reporter | wczekalski (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Attachment: Download
Environment
>lldb -version lldb-340.4.110.1 Additional Detail from JIRA
| Votes | 0 |
| Component/s | Standard Library |
| Labels | Bug |
| Assignee | @tbkka |
| Priority | Medium |
md5: 295299b47bb427386aa275afabcc8598
is duplicated by:
- [SR-491] Double#description is not roundtrip-safe #43108
- [SR-454] Reimplement float -> string with better algorithms #43071
- [SR-3131] String(someDouble) incorrectly switches to scientific notation for large integers #45719
relates to:
Issue Description:
It looks like the string representation of a Double returned by description is less precise than the Double itself. Look at the example below.
let point = CGPoint(x: 350.00000000000017, y: 0) let value: CGFloat = 350.0 if point.x == value { // correctly, will never be reached print("") } print(point.x) // prints 350.0Metadata
Metadata
Assignees
Labels
CustomStringConvertibleArea → standard library: The `CustomStringConvertible` protocolArea → standard library: The `CustomStringConvertible` protocolDoubleArea → standard library: The `Double` typeArea → standard library: The `Double` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaArea: Standard library umbrellaunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output