Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2bd9be1cc2b8
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1473783c197e
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 30, 2020

  1. Constexpr vs. const.

    pleroy committed Mar 30, 2020
    Copy the full SHA
    b4b83b5 View commit details
  2. Merge pull request #2513 from pleroy/Constexpr

    Use the CONSTEXPR_INFINITY macro for new constants
    pleroy authored Mar 30, 2020
    Copy the full SHA
    1473783 View commit details
Showing with 6 additions and 3 deletions.
  1. +2 −1 base/macros.hpp
  2. +4 −2 quantities/quantities.hpp
3 changes: 2 additions & 1 deletion base/macros.hpp
Original file line number Diff line number Diff line change
@@ -155,7 +155,8 @@ inline void noreturn() { std::exit(0); }
#define CONSTEXPR_CHECK(condition) CHECK(condition)

// Clang for some reason doesn't like FP arithmetic that yields infinities in
// constexpr code (MSVC and GCC are fine with that).
// constexpr code (MSVC and GCC are fine with that). This will be fixed in
// Clang 9.0.0, all hail zygoloid.
#if PRINCIPIA_COMPILER_CLANG || PRINCIPIA_COMPILER_CLANG_CL
# define CONSTEXPR_INFINITY const
#else
6 changes: 4 additions & 2 deletions quantities/quantities.hpp
Original file line number Diff line number Diff line change
@@ -130,10 +130,12 @@ constexpr Q SIUnit() { return Q(1); };

// A positive infinity of |Q|.
template<typename Q>
constexpr Q Infinity = SIUnit<Q>() * std::numeric_limits<double>::infinity();
CONSTEXPR_INFINITY Q Infinity =
SIUnit<Q>() * std::numeric_limits<double>::infinity();
// A quiet NaN of |Q|.
template<typename Q>
constexpr Q NaN = SIUnit<Q>() * std::numeric_limits<double>::quiet_NaN();
CONSTEXPR_INFINITY Q NaN =
SIUnit<Q>() * std::numeric_limits<double>::quiet_NaN();

template<typename Q>
constexpr bool IsFinite(Q const& x);