Skip to content

Commit

Permalink
Improved integer and floating point formatted() methods.
Browse files Browse the repository at this point in the history
- [IntegerFormatStyle] I removed the trapping conversion to `Int`. IntegerFormatStyle can format big integers since (swiftlang#262).
- [FloatingPointFormatStyle] I removed the rounding conversion to `Double`. `formatted()` now does whatever `format(_:)` does.
- [Decimal.FormatStyle] N/A (there were no conversions here).
  • Loading branch information
oscbyspro committed Dec 11, 2023
1 parent 1bb0cbb commit 58e6948
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension BinaryFloatingPoint {

/// Format `self` with `FloatingPointFormatStyle()`.
public func formatted() -> String {
FloatingPointFormatStyle().format(Double(self))
FloatingPointFormatStyle().format(self)
}

/// Format `self` with the given format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extension BinaryInteger {

/// Format `self` using `IntegerFormatStyle()`
public func formatted() -> String {
IntegerFormatStyle().format(Int(self))
IntegerFormatStyle().format(self)
}

/// Format `self` with the given format.
Expand Down

0 comments on commit 58e6948

Please sign in to comment.