Skip to content

Commit 00fd2a0

Browse files
committed
Add pow(_: Decimal, _: Int) to sclf (already present in Darwin overlay)
1 parent ec6a25b commit 00fd2a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Foundation/Decimal.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ extension Decimal {
100100
public typealias CalculationError = NSDecimalNumber.CalculationError
101101
}
102102

103+
public func pow(_ x: Decimal, _ y: Int) -> Decimal {
104+
var x = x
105+
var result = Decimal()
106+
NSDecimalPower(&result, &x, y, .plain)
107+
return result
108+
}
109+
103110
extension Decimal : Hashable, Comparable {
104111
// (Used by VariableLengthNumber and doubleValue.)
105112
fileprivate subscript(index: UInt32) -> UInt16 {

0 commit comments

Comments
 (0)