File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Sources/TimecodeKit/Utilities Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,20 @@ extension Fraction {
206
206
let num = ( lhs. numerator * lcm. lhsMultiplier) - ( rhs. numerator * lcm. rhsMultiplier)
207
207
return Fraction ( reducing: num, lcm. denominator)
208
208
}
209
+
210
+ public static func * ( lhs: Self , rhs: Self ) -> Self {
211
+ Fraction ( reducing: lhs. numerator * rhs. numerator, lhs. denominator * rhs. denominator)
212
+ }
213
+
214
+ public static func / ( lhs: Self , rhs: Self ) -> Self {
215
+ // Check for division by zero scenario
216
+ guard rhs. numerator != 0 else {
217
+ fatalError ( " Division by zero. " )
218
+ }
219
+
220
+ // Multiply lhs by the reciprocal of rhs
221
+ return Fraction ( reducing: lhs. numerator * rhs. denominator, lhs. denominator * rhs. numerator)
222
+ }
209
223
}
210
224
211
225
// MARK: - Double
You can’t perform that action at this time.
0 commit comments