Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / histogram / examples / guide_axis_with_transform.cpp
index 1caefdb..9b3412a 100644 (file)
@@ -17,8 +17,8 @@ int main() {
   // log transform:
   // - useful when values vary dramatically in magnitude, like brightness of stars
   // - edges are not exactly at 10, 100, 1000, because of finite floating point precision
-  // - value >= 0 below is mapped to -1
-  // - value < 0 below is mapped to `size()`, because the result of std::log is NaN
+  // - values >= 0 but smaller than the starting value of the axis are mapped to -1
+  // - values < 0 are mapped to `size()`, because the result of std::log(value) is NaN
   assert(r_log.index(10.1) == 0);
   assert(r_log.index(100.1) == 1);
   assert(r_log.index(1000.1) == 2);
@@ -30,8 +30,8 @@ int main() {
   axis::regular<double, axis::transform::sqrt> r_sqrt{3, 4., 25.};
   // sqrt transform:
   // - bin widths are more mildly increasing compared to log transform
-  // - starting axis at value == 0 is ok, sqrt(0) == 0 unlike log transform
-  // - value < 0 is mapped to `size()`, because the result of std::sqrt is NaN
+  // - axis starting at value == 0 is ok, sqrt(0) == 0 unlike log transform
+  // - values < 0 are mapped to `size()`, because the result of std::sqrt(value) is NaN
   assert(r_sqrt.index(0) == -1);
   assert(r_sqrt.index(4.1) == 0);
   assert(r_sqrt.index(9.1) == 1);
@@ -43,9 +43,9 @@ int main() {
   using pow_trans = axis::transform::pow;
   axis::regular<double, pow_trans> r_pow(pow_trans{1. / 3.}, 3, 1., 64.);
   // pow transform:
-  // - generalization of the sqrt transform, power index is first argument of ctor
-  // - starting the axis at value == 0 is ok, 0^p == 0 for p != 0
-  // - value < 0 is mapped to `size()`, because the result of std::pow is NaN
+  // - generalization of the sqrt transform
+  // - starting the axis at value == 0 is ok for power p > 0, 0^p == 0 for p > 0
+  // - values < 0 are mapped to `size()` if power p is not a positive integer
   assert(r_pow.index(0) == -1);
   assert(r_pow.index(1.1) == 0);
   assert(r_pow.index(8.1) == 1);