Power dropped in format of user defined unit
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 171
- Forks
- 35
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 3
Description
Given the unit `Å^2/barn^2`, `to_string` correctly formats this as `"1/am^2"`. However, when defining custom units for "Å" and "barn", `Å^2/barn^2` is rendered as `"Å/barn^2"`. That is, the square on Å is lost.
Also, `am` is now incorrectly rendered as `"1/Å/barn"`.
The custom units are defined as
```cpp
units::addUserDefinedUnit("Å", units::unit_from_string("Å", units::strict_si));
units::addUserDefinedUnit("barn", units::unit_from_string("barn", units::strict_si));
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Å^2/barn^2 and am cases with the C++ example in the issue, then trace custom-unit registration and the to_string formatting path. Add a regression test for both expressions; done means the exponent on Å is preserved and am is rendered correctly after defining the custom units.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100