Skip to content

Commit

Permalink
added one more test proving that the previous pound to kilogram conve…
Browse files Browse the repository at this point in the history
…rsion test passed just accidentally
  • Loading branch information
burnpanck committed Sep 16, 2024
1 parent 064e59e commit 10444cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/static/international_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ using namespace mp_units::international::unit_symbols;

// Mass
static_assert(100'000'000 * isq::mass[lb] == 45'359'237 * isq::mass[si::kilogram]);
// 47 * 45'359'237 = 2'131'884'139 = 0x7F11'F86B; the largest value that fits a signed int32 in this comparison
// 47 * 100'000'000 = 4'700'000'000 = 0x1'1824'4F00 will be truncated to 0x1824'4F00.
static_assert(47 * isq::mass[lb] < 47 * isq::mass[si::kilogram]);
// 10^14 easily fits into int64 (which has about a range 10^19); but converted to the gcd, it doesn't!
static_assert(100'000'000'000'000 * isq::mass[lb] == 45'359'237'000'000 * isq::mass[si::kilogram]);
static_assert(1 * isq::mass[lb] == 16 * isq::mass[oz]);
Expand Down

0 comments on commit 10444cc

Please sign in to comment.