Skip to content

Bug: Prefixes in unit multiplication with same base unit

Test code:

from dsiUnits import dsiUnit

u_cm = dsiUnit(r"\centi\metre")
u_m = dsiUnit(r"\metre")
u_s = dsiUnit(r"\second")

print(f"s * cm = {u_s*u_cm}")
print(f"cm * s = {u_cm*u_s}")
print(f"cm * m = {u_cm*u_m}")
print(f"m * cm = {u_m*u_cm}")

Output:

s * cm = \centi\metre\second
cm * s = \centi\metre\second
cm * m = \centi\metre\tothe{2}
m * cm = \metre\tothe{2}

Expected output:

s * cm = \centi\metre\second
cm * s = \centi\metre\second
cm * m = \centi\metre\metre
m * cm = \metre\centi\metre