From b2cb305b1b98c02ce476fecea553e01109a81637 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 9 Dec 2024 09:35:41 +0100 Subject: [PATCH] Add explanatory comment for kOneUlp --- cpp/src/arrow/testing/math.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp/src/arrow/testing/math.cc b/cpp/src/arrow/testing/math.cc index 2f81207951b6f..05d08c2c52a48 100644 --- a/cpp/src/arrow/testing/math.cc +++ b/cpp/src/arrow/testing/math.cc @@ -27,6 +27,9 @@ namespace arrow { namespace { +// `kOneUlp` is equal to 1.0 - (1.0 - nextafter(1.0, -inf)). +// That is, it is the delta between 1.0 and the FP value immediately before 1.0. +// We're using this value because `frexp` returns a mantissa between 0.5 and 1.0. template constexpr Float kOneUlp; template <>