Skip to content

round doesn't convert the magnitude of a quantity to int #2081

@Kodiologist

Description

@Kodiologist
>>> import pint; U = pint.UnitRegistry()
>>> round(1.1), type(round(1.1))
(1, <class 'int'>)
>>> round(1.1 * U.kg), type(round(1.1 * U.kg).magnitude)
(<Quantity(1.0, 'kilogram')>, <class 'float'>)

I'm not sure if this is a bug, but it certainly surprised me.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions