From 5d456292adf916a542989c9ea61ba3e06a89dc0f Mon Sep 17 00:00:00 2001 From: Joakim Hassila Date: Mon, 21 Sep 2026 11:08:50 +0200 Subject: [PATCH 1/2] feat(minor): Make fractionalDigitCount public Formatting and parsing code outside the module needs the number of fractional digits to size fraction lengths, quantums and exponents, and had to hard-code 8 or keep a local patch of this file. The accessor is a constant, so it is also @inlinable; the storage layout is unchanged. Co-Authored-By: Claude Fable 5.1 --- Sources/FixedPointDecimal/FixedPointDecimal.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/FixedPointDecimal/FixedPointDecimal.swift b/Sources/FixedPointDecimal/FixedPointDecimal.swift index 820e18d..a270141 100644 --- a/Sources/FixedPointDecimal/FixedPointDecimal.swift +++ b/Sources/FixedPointDecimal/FixedPointDecimal.swift @@ -37,8 +37,11 @@ public struct FixedPointDecimal: Sendable, BitwiseCopyable { internal var _storage: Int64 /// The number of fractional decimal digits (always 8). - @usableFromInline - internal static var fractionalDigitCount: Int { 8 } + /// + /// Public so formatting and parsing code in other modules can size fraction lengths, quantums + /// and exponents from the type instead of hard-coding 8. + @inlinable + public static var fractionalDigitCount: Int { 8 } /// The scale factor: 10⁸ = 100,000,000. @usableFromInline From f8fabd9874add61943e227a46abddc34940f01da Mon Sep 17 00:00:00 2001 From: Joakim Hassila Date: Mon, 21 Sep 2026 11:24:38 +0200 Subject: [PATCH 2/2] docs(patch): Describe fractionalDigitCount by its use and list it in the DocC topics Review feedback on #8: the doc comment states what the value is for rather than why it was made public, and the DocC constants group links the newly public property. Co-Authored-By: Claude Fable 5.1 --- .../FixedPointDecimal.docc/FixedPointDecimal.md | 1 + Sources/FixedPointDecimal/FixedPointDecimal.swift | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/FixedPointDecimal/FixedPointDecimal.docc/FixedPointDecimal.md b/Sources/FixedPointDecimal/FixedPointDecimal.docc/FixedPointDecimal.md index 9f0491c..e3cacf0 100644 --- a/Sources/FixedPointDecimal/FixedPointDecimal.docc/FixedPointDecimal.md +++ b/Sources/FixedPointDecimal/FixedPointDecimal.docc/FixedPointDecimal.md @@ -65,6 +65,7 @@ All arithmetic operations compile to native integer instructions with zero heap - ``FixedPointDecimal/min`` - ``FixedPointDecimal/leastNonzeroMagnitude`` - ``FixedPointDecimal/greatestFiniteMagnitude`` +- ``FixedPointDecimal/fractionalDigitCount`` - ``FixedPointDecimal/isNaN`` - ``FixedPointDecimal/isFinite`` - ``FixedPointDecimal/sign`` diff --git a/Sources/FixedPointDecimal/FixedPointDecimal.swift b/Sources/FixedPointDecimal/FixedPointDecimal.swift index a270141..2b31d70 100644 --- a/Sources/FixedPointDecimal/FixedPointDecimal.swift +++ b/Sources/FixedPointDecimal/FixedPointDecimal.swift @@ -38,8 +38,7 @@ public struct FixedPointDecimal: Sendable, BitwiseCopyable { /// The number of fractional decimal digits (always 8). /// - /// Public so formatting and parsing code in other modules can size fraction lengths, quantums - /// and exponents from the type instead of hard-coding 8. + /// Use this value to derive fractional digit limits and decimal scaling exponents. @inlinable public static var fractionalDigitCount: Int { 8 }