apple / swift-numerics

Advanced mathematical types and functions for Swift
Apache License 2.0
1.68k stars 142 forks source link

Make all (IntegerUtilities) rounding rules available to FloatingPoint #297

Closed stephentyrone closed 1 month ago

stephentyrone commented 1 month ago

IntegerUtilities has RoundingRule that is a superset of FloatingPointRoundingRule; many of these are also useful when working with floating-point. This change provides a rounding(_:) function similar to the standard libraries rounded(_:) that makes all of them available. It has a different name instead of being a shadow because otherwise existing use sites like rounded(.down) would become ambiguous.

stephentyrone commented 1 month ago

@swift-ci test