Fix FloatingPoint functions: Replace instance calls with static Double #5226
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolved log10 and pow errors by explicitly calling Double.log10() and Double.pow(). Fixed type mismatch in division operation (shifted / magnitude). Ensured compatibility with latest Swift compiler requirements. Preparing to apply these fixes to the main library as well.
Goals ⚽
Fix Swift 5.9+ compatibility issues related to log10 and pow usage.
Ensure the library builds successfully on Xcode 16 and remains backward compatible.
Implementation Details 🚧
Replaced instance method calls on Double (log10, pow) with Foundation equivalents:
Before: log10(self < 0 ? -self : self)
After: Foundation.log10(abs(self))
Before: pow(10.0, Double(pw))
After: Foundation.pow(10.0, Double(pw))
Ensured compatibility with Swift 5.9+ by explicitly calling Foundation methods.
Updated code to ensure correct return types (e.g., Double instead of Duration).
Testing Details 🔍
Verified successful local builds on Xcode 16.
Tested with SwiftLint to ensure no new lint violations.
Validated changes using unit tests where applicable.