@@ -156,7 +156,7 @@ public struct BigInt: Hashable,
156
156
self . init ( words: [ BigInt . loword ( absvalue) , BigInt . hiword ( absvalue) ] , negative: value < 0.0 )
157
157
} else {
158
158
let x = BigInt ( UInt64 ( value. significand * pow( 2.0 , 63.0 ) ) )
159
- let y = x * BigInt( 2 ) . toPowerOf ( BigInt ( value. exponent - 63 ) )
159
+ let y = x * BigInt( 2 ) . toPower ( of : BigInt ( value. exponent - 63 ) )
160
160
self . init ( words: y. words, negative: value < 0.0 )
161
161
}
162
162
}
@@ -525,8 +525,13 @@ public struct BigInt: Hashable,
525
525
return true
526
526
}
527
527
528
- /// Divides `self` by `rhs` and returns the result as a `BigInt`.
528
+ @ available ( * , deprecated , renamed : " divided(by:) " )
529
529
public func dividedBy( _ rhs: BigInt ) -> ( quotient: BigInt , remainder: BigInt ) {
530
+ return self . divided ( by: rhs)
531
+ }
532
+
533
+ /// Divides `self` by `rhs` and returns the result as a `BigInt`.
534
+ public func divided( by rhs: BigInt ) -> ( quotient: BigInt , remainder: BigInt ) {
530
535
guard rhs. words. count <= self . words. count else {
531
536
return ( BigInt ( 0 ) , self . abs)
532
537
}
@@ -566,8 +571,13 @@ public struct BigInt: Hashable,
566
571
return ( BigInt ( words: res, negative: neg) , BigInt ( words: rem, negative: self . negative) )
567
572
}
568
573
569
- /// Raises this `BigInt` value to the radixPow of `exp`.
574
+ @ available ( * , deprecated , renamed : " toPower(of:) " )
570
575
public func toPowerOf( _ exp: BigInt ) -> BigInt {
576
+ return self . toPower ( of: exp)
577
+ }
578
+
579
+ /// Raises this `BigInt` value to the radixPow of `exp`.
580
+ public func toPower( of exp: BigInt ) -> BigInt {
571
581
return pow ( self , exp)
572
582
}
573
583
@@ -720,12 +730,12 @@ extension BigInt: ExpressibleByIntegerLiteral,
720
730
}
721
731
722
732
public static func divideWithOverflow( _ lhs: BigInt , _ rhs: BigInt ) -> ( BigInt , overflow: Bool ) {
723
- let res = lhs. dividedBy ( rhs)
733
+ let res = lhs. divided ( by : rhs)
724
734
return ( res. quotient, overflow: false )
725
735
}
726
736
727
737
public static func remainderWithOverflow( _ lhs: BigInt , _ rhs: BigInt ) -> ( BigInt , overflow: Bool ) {
728
- let res = lhs. dividedBy ( rhs)
738
+ let res = lhs. divided ( by : rhs)
729
739
return ( res. remainder, overflow: false )
730
740
}
731
741
0 commit comments