From fa715ffc775c42cc096f6e7dcff9bf9288e7398c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 18 Nov 2024 12:12:24 +0100 Subject: [PATCH] Add a comment about use cases of util_*_infinity() --- src/util/fpclassify.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util/fpclassify.h b/src/util/fpclassify.h index 4966254b019..8f30a8a63db 100644 --- a/src/util/fpclassify.h +++ b/src/util/fpclassify.h @@ -25,5 +25,10 @@ int util_isnan(double x); int util_isinf(float x); int util_isinf(double x); +// The following functions are only used in testing code. +// Don't use them in other -ffast-math code to avoid undefined behavior in +// floating-point arithmetic where the compiler assumes that arguments and +// results are not NaNs or +-Infs. For checking external librarie's return +// values use the appropiated function above. float util_float_infinity(); double util_double_infinity();