fix issue #1178 by YanruiWang · Pull Request #1203 · SwiftyJSON/SwiftyJSON · GitHub
Skip to content

fix issue #1178 - #1203

Open
YanruiWang wants to merge 1 commit into
SwiftyJSON:masterfrom
YanruiWang:float_fix
Open

YanruiWang wants to merge 1 commit into
SwiftyJSON:masterfrom
YanruiWang:float_fix

Conversation

@YanruiWang

Copy link
Copy Markdown

#1178

for small float numbers, remove Small trailing digits when print them

The PR should summarize what was changed and why. Here are some questions to
help you if you're not sure:

  • What behavior was changed?

  • Correctly print number 8.8

  • What code was refactored / updated to support this change?

  • **SwiftyJSON.swift line 788

  • What issues are related to this PR? Or why was this change introduced?

  • issue Parsing double error, eg: 8.8 be convert to 8.8000000000000007 #1178
    Checklist - While not every PR needs it, new features should consider this list:

  • [ X] Does this have tests?

  • Does this have documentation?

  • Does this break the public API (Requires major version bump)?

  • Is this a new feature (Requires minor version bump)?

SwiftyJSON#1178

for small float numbers, remove Small trailing digits when print them

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

XCTAssertTrue(json.floatValue == 54321.12345)
XCTAssertEqual(json.numberValue, 54321.12345)
XCTAssertEqual(json.stringValue, "54321.12345")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}
return ""


Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)

return rawNumber.stringValue
}
return ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'n' (identifier_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants