Skip to content

[SR-106] description returns a rounded value of Double #42728

Closed
@swift-ci

Description

@swift-ci
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:

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.0

Metadata

Metadata

Assignees

Labels

CustomStringConvertibleArea → standard library: The `CustomStringConvertible` protocolDoubleArea → standard library: The `Double` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrellaunexpected behaviorBug: Unexpected behavior or incorrect output

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions