iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis
Apache License 2.0
1.03k stars 98 forks source link

Arbitrary power of units #486

Closed StHagel closed 1 month ago

StHagel commented 1 month ago

Is there currently a way to define powers of units, e.g. energy squared/energy cubed? I often work with units like GeV² or GeV^{-1} and it would be cool to be able to represent them using uom.

If this is not possible or planned, it would be cool if Energy² and Energy^{-1} could be added as a unit, especially in units of prefix-electronvolt.

iliekturtles commented 1 month ago

See #357 and #244 for discussion about this issue. In short you can define your own type alias for the quantity. You may be able to use the unit! macro to create your own units, but no one has followed up on #244.

And of course PRs for new quantities are always welcome.

Marking this issue closed since I believe the linked issues cover the issue here. Let me know if you think this should be re-opened.