Skip to content

Multiplication is not equivalent when multiplying offset units by a float and dimensionless Quantity. #2262

@mile-gepek

Description

@mile-gepek
from pint import UnitRegistry

ureg = UnitRegistry(autoconvert_offset_to_baseunit=True)

print(100 == ureg.Quantity(100)) # True

celsius = ureg.Quantity("celsius")

hundred_celsius = 100 * celsius
print(hundred_celsius)  # 100 C

hundred_celsius = ureg.Quantity(100) * celsius
print(hundred_celsius)  # 27414 kelvin

Given Quantity(100) is equal to the int/float 100, I'd expect it to behave the same when multiplying by an offset unit, but it seems to autoconvert to kelvin instead, and only then multiply by a 100.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions