Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions si-units/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Generalized indexing, such that, e.g., general multidimensional slicing operations are possible for quantities containing NumPy arrays. [#110](https://github.com/itt-ustutt/quantity/pull/110)

### Fixed
- Fixed the String representation of non-scalar mass quantities. [#111](https://github.com/itt-ustutt/quantity/pull/111)

## [0.11.3] - 2026-04-22
### Added
- Added stub information for methods and constants. [#106](https://github.com/itt-ustutt/quantity/pull/106)
Expand Down
9 changes: 8 additions & 1 deletion si-units/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ impl PySIObject {
.value
.call_method0(py, "__repr__")?
.extract::<String>(py)?;
Ok(format!("{} {}", value, self.unit))
let unit = if self.unit == _KILOGRAM {
// because the base unit already has a prefix, we cannot call
// unit.to_string() on it (it would return 'g').
"kg".into()
} else {
self.unit.to_string()
};
Ok(format!("{} {}", value, unit))
}
}

Expand Down
Loading