Skip to content

Commit

Permalink
feat: alternative litre unit symbol L added to prevent ambiguities …
Browse files Browse the repository at this point in the history
…with `1`
  • Loading branch information
mpusz committed Oct 6, 2024
1 parent 2249879 commit dd55a52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/users_guide/framework_basics/text_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,15 @@ In most cases [scaled units are hidden behind named units](systems_of_units.md#s
However, there are a few real-life where a user directly faces a scaled unit. For example:

```cpp
constexpr Unit auto l_per_100km = l / (mag<100> * km);
constexpr Unit auto L_per_100km = L / (mag<100> * km);
```

The above is a derived unit of litre divided by a scaled unit of 100 kilometers. As we can
see a scaled unit has a magnitude and a reference unit. To denote the scope of such
a unit, we enclose it in `[...]`. For example, the following:

```cpp
std::cout << 6.7 * l_per_100km << "\n";
std::cout << 6.7 * L_per_100km << "\n";
```

prints:
Expand Down
1 change: 1 addition & 0 deletions src/systems/include/mp-units/systems/si/unit_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ inline constexpr auto arcsec = arcsecond;
inline constexpr auto a = are;
inline constexpr auto ha = hectare;
inline constexpr auto l = litre;
inline constexpr auto L = litre; // both versions of litre are allowed
inline constexpr auto t = tonne;
inline constexpr auto Da = dalton;
inline constexpr auto eV = electronvolt;
Expand Down

0 comments on commit dd55a52

Please sign in to comment.