pow_constexpr_test.cc
Go to the documentation of this file.
1 #include "cetlib/pow.h"
2 
3 int
4 main()
5 {
6  static_assert(cet::pow<2>(3) == 9);
7  static_assert(cet::pow<3>(2) == 8);
8  static_assert(cet::pow<2>(0.5) == 0.25);
9  static_assert(cet::pow<1>(0.0f) == 0.0);
10 
11  static_assert(cet::diff_of_squares(13, 12) == 25);
12  static_assert(cet::diff_of_squares(13u, 12u) == 25u);
13  static_assert(cet::diff_of_squares(13L, 12L) == 25L);
14  static_assert(cet::diff_of_squares(13., 12.) == 25.);
15 
16  static_assert(cet::sum_of_squares(13, 12) == 313);
17  static_assert(cet::sum_of_squares(13u, 12u) == 313u);
18  static_assert(cet::sum_of_squares(13L, 12L) == 313L);
19  static_assert(cet::sum_of_squares(13., 12.) == 313.);
20 }
int main()
constexpr T diff_of_squares(T x, T y)
Definition: pow.h:132
constexpr T sum_of_squares(T x, T y)
Definition: pow.h:139