Skip to content

Commit b76b903

Browse files
Copilotmpusz
andauthored
fix: correct sidereal_day magnitude and standardize digit separators in astronomy.h (#787)
* fix: correct sidereal_day constant in astronomy.h (issue #786) Agent-Logs-Url: https://github.com/mpusz/mp-units/sessions/80776de1-96d9-40da-ab02-767a215efba3 Co-authored-by: mpusz <506260+mpusz@users.noreply.github.com> * style: fix non-standard C++ digit separators in astronomy.h Agent-Logs-Url: https://github.com/mpusz/mp-units/sessions/d6c3365e-2620-4422-87dd-11d537ebe76e Co-authored-by: mpusz <506260+mpusz@users.noreply.github.com> * Update astronomy_test.cpp content * Restoring empty line separators * Fix formatting in astronomy_test.cpp * Refactor static assertions in astronomy_test.cpp Updated static assertions for time and length units in astronomy tests. * Fix static_assert syntax in astronomy_test.cpp * Fix static_assert statements in astronomy_test.cpp --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mpusz <506260+mpusz@users.noreply.github.com> Co-authored-by: Mateusz Pusz <mateusz.pusz@gmail.com>
1 parent 2eb094c commit b76b903

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/systems/include/mp-units/systems/astronomy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ namespace mp_units::astronomy {
4040
// clang-format off
4141
// time
4242
inline constexpr struct day final : named_unit<"D", non_si::day> {} day;
43-
inline constexpr struct sidereal_day final : named_unit<"D_sid", mag_ratio<86'164'0905, 1'000'000> * si::second> {} sidereal_day;
44-
inline constexpr struct Julian_year final : named_unit<"a", mag_ratio<365'25, 100> * day> {} Julian_year;
45-
inline constexpr struct tropical_year final : named_unit<"a_trop", mag_ratio<365'242189, 1'000'000> * day> {} tropical_year;
43+
inline constexpr struct sidereal_day final : named_unit<"D_sid", mag_ratio<861'640'905, 10'000> * si::second> {} sidereal_day;
44+
inline constexpr struct Julian_year final : named_unit<"a", mag_ratio<36'525, 100> * day> {} Julian_year;
45+
inline constexpr struct tropical_year final : named_unit<"a_trop", mag_ratio<365'242'189, 1'000'000> * day> {} tropical_year;
4646
inline constexpr struct century final : named_unit<"c", mag<100> * Julian_year> {} century;
4747
inline constexpr struct millennium final : named_unit<"ka", mag<1000> * Julian_year> {} millennium;
4848

test/static/astronomy_test.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ using namespace mp_units::si::unit_symbols;
3232
using mp_units::astronomy::unit_symbols::a;
3333

3434
// time units
35-
static_assert(1. * D == 86'400. * s);
36-
static_assert(approx_equal(1. * D_sid, (86'164'0905. / 1'000'000.) * s));
37-
static_assert(approx_equal(1. * a, 365.25 * D));
38-
static_assert(approx_equal(1. * a, 31'557'600. * s));
35+
static_assert(1 * D == 86'400 * s);
36+
static_assert(10'000 * D_sid == 861'640'905 * s);
37+
static_assert(100 * a == 36525 * D);
38+
static_assert(1 * a == 31'557'600 * s);
3939
static_assert(approx_equal(1. * a_trop, 365.242189 * D));
40-
static_assert(1. * c == 100. * a);
41-
static_assert(1. * ka == 1000. * a);
40+
static_assert(1 * c == 100 * a);
41+
static_assert(1 * ka == 1000 * a);
4242

4343
// length units
44-
static_assert(1. * LD == 384'399. * km);
45-
static_assert(1. * ly == 9'460'730'472'580'800. * m);
44+
static_assert(1 * LD == 384'399 * km);
45+
static_assert(1 * ly == 9'460'730'472'580'800 * m);
4646

4747
// spectral flux density
4848
static_assert(approx_equal(1. * Jy, 1e-26 * W / m2 / Hz));

0 commit comments

Comments
 (0)