Skip to content

Inverse centimeter as an energy unit #472

Closed Answered by mpusz
khansson asked this question in Q&A
Discussion options

You must be logged in to vote

OK, I did some reading, and I think I know now what you are asking for. To answer your question directly, it is impossible for the same SI unit to measure both length and energy quantities, as the SI is explicit about what those units describe.

However, the library provides Faster than Lightspeed Constants that allow you to be physically correct and not impact the runtime performance or the precision of the result. For example, you can write:

constexpr auto c = 1 * si::si2019::speed_of_light_in_vacuum;
constexpr auto h = 1 * si::si2019::planck_constant;

auto wavenumber = 1200. * isq::wavenumber[1 / cm];
QuantityOf<isq::energy> auto energy = wavenumber * h * c;

std::cout << "Wavenumber: "

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@mpusz
Comment options

Answer selected by khansson
@mpusz
Comment options

@khansson
Comment options

@mpusz
Comment options

@i-ky
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants