Commit Graph
242 Commits
Author SHA1 Message Date
Mateusz Pusz 83aee04da0 refactor: quantity_io.h renamed to iostream.h 2023-02-03 16:57:48 +01:00
Mateusz Pusz b4f47c3fef feat: value_cast support added
Resolves #239 and #120
2023-02-03 11:08:13 +01:00
Mateusz Pusz 9a7a55b873 test: test's text output fixed after unit ordering change 2023-01-05 10:39:23 +01:00
Mateusz Pusz 163295842e test: initial version of linear_algebra_test added 2023-01-04 19:06:25 +01:00
Mateusz Pusz 2cf736a1e6 feat: preventing possible future units crash when using namespace std;
Resolves #317
2022-12-29 20:18:48 +01:00
Mateusz Pusz 6b72dd39c1 refactor: headers with system definitions moved to _systems_ subdirectory 2022-12-29 19:27:54 +01:00
Mateusz Pusz 97da55edfa refactor: the rest of the systems refactored for V2 2022-12-29 18:59:10 +01:00
Mateusz Pusz 2a3e1f6035 refactor: angular system created 2022-12-25 17:32:29 +01:00
Mateusz Pusz 07687f9ef6 refactor: _generic/dimensionless.h_ removed (units added to _unit.h_) 2022-12-25 17:14:54 +01:00
Mateusz Pusz 82b1f7ffc0 refactor(example): RepresentationOf support added to examples 2022-12-20 17:26:55 +01:00
Mateusz Pusz b7884b90a8 Revert "feat: ISQ quantity names conflicts resolved with inline namespaces"
This reverts commit 043410d2f8.
2022-12-20 12:46:07 +01:00
Mateusz Pusz 043410d2f8 feat: ISQ quantity names conflicts resolved with inline namespaces 2022-12-20 11:20:47 +01:00
Mateusz Pusz a96c34c17a fix: exp() implementation fixed 2022-12-19 12:49:15 +01:00
Mateusz Pusz 92c70f1a4e feat: quantity_spec support added 2022-12-16 18:15:48 +01:00
Mateusz Pusz 91f26759d6 refactor: more unit tests refactored 2022-12-01 20:59:16 +01:00
Mateusz Pusz 7b6fc18e20 refactor: distribution_test refactored for V2 2022-11-09 22:54:22 -10:00
Mateusz Pusz 7423acd6a7 test: negative tests for formatting added 2022-11-08 11:19:12 -10:00
Mateusz Pusz c32a4cea8a test: fmt tests refactored for V2 2022-11-07 16:21:30 -10:00
Mateusz Pusz 4a49bdda05 refactor: V2 design update 2022-10-06 23:43:01 +01:00
Mateusz Pusz d0eceefe80 refactor: dead ratio code removed 2022-09-06 23:49:16 +02:00
Mateusz Pusz a39a49c147 test: VS2019 compilation fixed 2022-09-02 10:21:58 +02:00
Mateusz Pusz 396d39c35b test: AlmostEqualsMatcher compilation fixed 2022-09-01 17:18:02 +02:00
Mateusz Pusz a95cb53f73 test: unit tests for trigonometric functions added 2022-09-01 16:25:33 +02:00
Mateusz Pusz 707b39f0c4 build: catch2 updated to 3.1.0 2022-09-01 16:19:51 +02:00
Mateusz Pusz c1d23b41c1 refactor: pi-based magnitude renamed to mag_pi 2022-09-01 10:47:36 +02:00
Chip Hogg df290a74f0 Remove shadowing declaration of pi 2022-08-11 15:56:10 +00:00
Mateusz Pusz a1e1b70b92 test: Unit tests for 3-argument hypot added 2022-08-03 13:35:18 +02:00
Mateusz Pusz 4c8b3ce290 test: Commented out ceil unit test enabled as it works correctly now 2022-08-03 13:12:24 +02:00
Mateusz Pusz b252da0fe1 test: hypot unit tests added 2022-08-03 13:10:59 +02: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 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 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 ef9e6522ca Merge branch 'master' into chiphogg/switch-to-mag 2022-06-15 20:50:30 +00: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
Chip Hogg 59fa420272 Fix remaining builds/tests 2022-05-12 16:52:05 +00:00
Chip Hogg 5fb468697b Merge branch 'master' into chiphogg/switch-to-mag 2022-05-12 16:12:01 +00:00
Mateusz Pusz 5300caf17b refactor: 💥 ! derived_deduced_unit renamed to derived_scaled_unit
Naming is hard ;-)
2022-05-11 12:34:52 +02:00
Mateusz Pusz f5d21a0711 refactor: 💥 ! derived_unit renamed to derived_deduced_unit 2022-05-11 11:23:18 +02:00
Mateusz Pusz a0c6252567 refactor: mi(naut) renamed to nmi
Relates to #357
2022-04-19 18:47:48 +02:00
Chip Hogg 78bcb3b019 Remove troublesome ::ratio members
For some reason, MSVC seems to want to instantiate these, even though
nobody ever asks for them (as evidenced by the fact that the builds
passed on other architectures).
2022-04-12 00:35:17 +00:00
Chip Hogg d19b2803ce Migrate units from ratio to Magnitude
This commit is huge, but hopefully the cognitive load is not too bad.
The bulk of this commit is just some fairly mechanical updates from
`ratio` to `Magnitude`.  Other things to call out:

- `UnitRatio` goes away.  We don't need this concept, because Magnitude
  can't even _represent_ anything that doesn't satisfy it.

- I commented out some formatting test cases where the precise
  expression changes, but the number is completely equivalent.  We will
  need to decide how we want to handle Magnitude formatting as a
  separate, follow-on task.  But at least Magnitude gives us all the
  tools we'll need to do so!
2022-04-11 15:16:16 +00:00
Chip Hogg af8eec1102 Implement "common Magnitude" of two Magnitudes 2022-04-11 15:16:15 +00:00
Chip Hogg 2c31bf83ec Clean up 2022-04-06 02:01:23 +00:00
Chip Hogg b616e58216 Give up on implicit conversion
I don't understand what MSVC is complaining about, and it may end up
being easier to just make the conversion explicit.
2022-04-06 01:40:17 +00:00
Chip Hogg 0f776b5b5b Remove incorrectly included test
We had removed this upstream, but apparently it snuck back in from a merge/rebase conflict.
2022-04-06 00:31:18 +00:00
Chip Hogg d7681e188e Support seamless interop between ratio and rational Magnitude
We provide two new functions, `numerator(m)` and `denominator(m)`, for a
Magnitude `m`.  They fulfill the following conditions:

1. `numerator(m)` and `denominator(m)` are always integer Magnitudes.
2. If `m` is rational, then `m == numerator(m) / denominator(m)`.

If `m` is _not_ rational, then the numerator and denominator are not
especially meaningful (there is no uniquely defined "leftover irrational
part").  However, we choose a convention that matches how humans would
write a mixed number.  For example, sqrt(27/16) would have a numerator
of 3, denominator of 4, and a "leftover part" of sqrt(3), matching the
"human" way of writing this as [(3 * sqrt(3)) / 4].  This has no use
yet, but it may later be useful in printing the Magnitude of an
anonymous Unit for end users.

To further reduce friction for the upcoming migration, we provide an
implicit conversion from a Magnitude to a `ratio`.  We restrict this
operation to rational Magnitudes, and guard this with a `static_assert`.
2022-04-05 23:03:44 +00:00
Markus Hofbauer cf7a7ed17a check: run pre-commit on all files 2022-04-02 18:58:23 +02:00
Chip Hogg 438feb3001 Remove offending unit test
Apparently, the constexpr depth which clang and MSVC can handle is too
shallow for me to write a unit test that works on all supported
compilers.
2022-03-19 17:05:55 +00:00