Commit Graph
254 Commits
Author SHA1 Message Date
Mateusz Pusz bb453e4a8a feat: cotes_angle constant added 2022-09-03 12:28:38 +02:00
Mateusz Pusz 9ae3403b18 feat: trigonometric functions on quantities support added 2022-09-01 16:25:11 +02:00
Mateusz Pusz e40a5d631c feat: solid angle support added 2022-09-01 12:16:47 +02:00
Mateusz Pusz 7719776711 feat: gradian support added 2022-09-01 10:48:34 +02:00
Mateusz Pusz c1d23b41c1 refactor: pi-based magnitude renamed to mag_pi 2022-09-01 10:47:36 +02:00
Mateusz Pusz 9891eab82b refactor: radian restored to be the reference unit for angle 2022-09-01 10:45:53 +02:00
Mateusz Pusz 74f442d316 refactor: quantity_ratio removed as it is no longer used by the framework 2022-08-31 21:23:01 +02:00
Mateusz Pusz dac7f81a67 fix: harmonic_ concept fixed to properly account for pi-based magnitudes 2022-08-31 21:12:00 +02:00
Mateusz Pusz 8b534c8d8b feat: degrees and rotations support added
Resolves #370
2022-08-31 12:57:24 +02:00
Mateusz Pusz 1b9cd8446c refactor: ipow10() and fpow10() removed as they are no longer used
Resolves #311
2022-08-31 10:53:13 +02:00
Mateusz Pusz d4f1e93d6c Merge pull request #375 from chiphogg/chiphogg/docs
Update prefix documentation
2022-08-23 10:28:30 +02:00
Björn Schäpers 9c514439d1 Fix: 32 bit overflow
../units/src/core/include/units/magnitude.h: In instantiation of 'static constexpr intmax_t units::detail::prime_factorization<N>::get_or_compute_first_factor() [with long long int N = 149597870700; intmax_t = long long int]':
../units/src/core/include/units/magnitude.h:627:74:   required from 'constexpr const intmax_t units::detail::prime_factorization<149597870700>::first_base'
../units/src/core/include/units/magnitude.h:632:54:   required from 'constexpr const auto units::detail::prime_factorization<149597870700>::value'
../units/src/core/include/units/magnitude.h:631:25:   required from 'struct units::detail::prime_factorization<149597870700>'
../units/src/core/include/units/magnitude.h:642:71:   required from 'constexpr const auto units::detail::prime_factorization_v<149597870700>'
../units/src/core/include/units/magnitude.h:655:18:   required from 'constexpr auto [requires units::Magnitude<<placeholder>, >] units::mag() [with ratio R = ratio{149597870700, 1}]'
../units/src/systems/si/include/units/isq/si/length.h:59:91:   required from here
../units/src/core/include/units/magnitude.h:623:70: error: unsigned conversion from 'long long int' to 'std::size_t' {aka 'unsigned int'} changes value from '149597870700' to '3568982636' [-Werror=overflow]
  623 |       return static_cast<std::intmax_t>(factorizer::find_first_factor(N));
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
2022-08-10 08:37:55 +02:00
Björn Schäpers cce0d2c12b Supress "zero as null pointer constant" warning 2022-08-10 08:18:30 +02:00
Björn Schäpers d1130c9d39 Suppress float-equal warning 2022-08-09 16:38:29 +02:00
Chip Hogg 10b553bdbe Adapt Aurora's Magnitude docs for mp-units
The major missing work here is to see how the latex math, inside dollar
signs, translates to the docs.

I also added a new constant, `pi`, to make the docs correct: this should
be much more user friendly.

This is not intended to be "complete".  Rather, the goal is to deliver
the raw content so that experts can massage it.
2022-08-04 19:13:53 +00:00
Mateusz Pusz 4e044c4e43 refactor: hypot was overconstrained 2022-08-03 13:51:18 +02:00
Mateusz Pusz 4313df390c refactor: hypot refactored to use variadic common_type version 2022-08-03 13:34:45 +02:00
Mateusz Pusz dd4679459d feat: hypot support added 2022-08-03 12:29:49 +02:00
Mateusz Pusz 9aa3fd4d00 fix: prefixed_alias_unit constraints fixed 2022-08-03 11:29:20 +02:00
Mateusz Pusz 0ebf85b9db fix: unknown_coherent_unit fixed 2022-08-01 11:59:00 +02:00
Mateusz Pusz bb5c02e09e fix: Quantity inversion operation fixed
Resolves #367
2022-08-01 10:03:55 +02:00
Mateusz Pusz 5bd378a835 refactor: base_units_ratio.h renamed to absolute_magnitude.h 2022-07-31 15:45:40 +02:00
Mateusz Pusz d50ed286b3 Merge pull request #381 from JohelEGP/llvm16
refactor: update hacks for LLVM 16
2022-07-30 10:49:44 +02:00
Johel Ernesto Guerrero Peña e988e1d74e refactor: update hacks for LLVM 16 2022-07-29 17:17:07 -04:00
Chip Hogg f6f7f9bafb Explicitly qualify mag<> that initializes mag member
This should fix clang's complaint.
2022-07-29 14:18:33 +00:00
Chip Hogg ea83af8aa9 Rename as_magnitude<...>() to mag<...>()
This is easier to write and to read.
2022-07-29 01:46:06 +00:00
Chip Hogg 0adee83866 Use mag_power to make callsites more concise 2022-07-27 14:30:38 +00:00
Chip Hogg 7e591115fa Remove ratio's numerator() and denominator()
These have now become trivial.
2022-07-20 00:52:37 +00:00
Chip Hogg 7fd6913b73 Replace exp with 0 everywhere, and remove it
This lets us remove a ton of special-casing throughout the codebase, and
just generally makes things a lot simpler.

We also remove the ability to take rational powers of `ratio`, including
`sqrt` and `cbrt` helpers, because these are intrinsically ill-defined.

Fixes #369.
2022-07-20 00:52:37 +00:00
Chip Hogg e1a173a02d Migrate prefixes to Magnitude 2022-07-07 17:09:42 +00:00
Chip Hogg 92750072b0 Reimplement ratio_text() as magnitude_text()
The algorithm is exactly the same; we just get our values for
`num_value`, `den_value`, and `exp10` in different ways.

The old printing logic assumed the ratio/Magnitude was an exact rational
number.  Formerly, we couldn't even _represent_ anything else, but with
Magnitude, we can.  Thus, we guard this assumption with a
`static_assert`.  Later on, we can figure out how we want to print
irrational bases and/or rational powers.  The point of this change is to
unblock us from moving to the new infrastructure.
2022-07-07 16:44:19 +00:00
Chip Hogg e1a17ab1f0 Use variables instead of ratio members
This prepares us for a time when we won't _have_ the `ratio` members
(because we'll be using `Magnitude`).
2022-07-07 16:33:51 +00:00
Chip Hogg 407a13c48f Add extract_power_of_10(Magnitude) utility
This will help with pretty-printing magnitudes by extracting a
reasonable power of 10.
2022-07-07 16:10:34 +00:00
Chip Hogg f004854a9e Remove useful names to appease MSVC 14
Looks like another compiler bug, where it considers a formal parameter
to be "unused" if it isn't used in any `if constexpr` branch.
2022-06-15 21:44:27 +00:00
Chip Hogg ef9e6522ca Merge branch 'master' into chiphogg/switch-to-mag 2022-06-15 20:50:30 +00:00
Mateusz Pusz f5e6d052ad fix: MSVC compilation error workaround 2022-06-09 13:50:41 +02:00
Mateusz Pusz 46b3781743 Revert "refactor: 💥 ! " ⋅ " replaced with "⋅" in derived unit symbols"
This reverts commit db09a065ab.
2022-05-24 14:20:17 +02:00
Mateusz Pusz 38fb9911a9 refactor: 💥 ! " ⋅ " replaced with "⋅" in derived unit symbols 2022-05-24 12:56:14 +02:00
Mateusz Pusz db09a065ab refactor: 💥 ! " ⋅ " replaced with "⋅" in derived unit symbols 2022-05-24 12:48:07 +02:00
Mateusz Pusz ef7e7c4cfc refactor: detail::same_scaled_units renamed to detail::compatible_units 2022-05-23 20:47:29 +02:00
Mateusz Pusz 842f2eaf27 feat: quantity CTAD guide added 2022-05-22 19:47:11 +02:00
Mateusz Pusz 43844c484c fix: UNITS_MSVC_WORKAROUND() fixed for other compilers 2022-05-14 11:27:12 +02:00
Mateusz Pusz b559a5f98f fix: explicit ratio creation added as a workaround for MSVC 2022-05-14 11:24:00 +02:00
Mateusz Pusz 6c1062e166 fix: UNITS_MSVC_WORKAROUND() added 2022-05-14 11:22:09 +02:00
Chip Hogg 86b81c9384 Undo misguided fix attempt 2022-05-12 21:53:51 +00:00
Chip Hogg 2bdc778ab6 Constrain template 2022-05-12 18:19:20 +00:00
Chip Hogg f36205f08d Capture NTTP in variable
This should make it OK for MSVC to take the address, working around a
compiler bug.
2022-05-12 18:17:35 +00:00
Chip Hogg 88a69cecd8 Try fixing build
Unfortunately, my local build hangs, so I can't tell whether this works.
2022-05-12 18:02:47 +00:00
Chip Hogg a0ac140a19 Merge fixes into branch after updating with upstream changes 2022-05-12 16:54:48 +00:00
Chip Hogg 59fa420272 Fix remaining builds/tests 2022-05-12 16:52:05 +00:00