From 0356d68cf24ffd73612671eeb62551377c44d673 Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Sat, 13 Sep 2025 22:55:24 +0200 Subject: [PATCH] Multiplication UnitValue * Number --- Sources/Units/Units.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sources/Units/Units.swift b/Sources/Units/Units.swift index 4e705cd..c748c40 100644 --- a/Sources/Units/Units.swift +++ b/Sources/Units/Units.swift @@ -383,6 +383,23 @@ public struct UnitValue: (lhs.value * rhs.value)[lhs.unit] } + /// The result will have the `unit` of the left hand side value. + public static func * ( + lhs: UnitValue, rhs: R + ) + -> UnitValue + { + (lhs.value * rhs.doubleValue)[lhs.unit] + } + + public static func * ( + lhs: L, rhs: UnitValue + ) + -> UnitValue + { + (lhs.doubleValue * rhs.value)[rhs.unit] + } + /// The result will have the `unit` of the left hand side value. public static func / ( lhs: UnitValue, rhs: UnitValue