summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-03-12 18:25:17 +0100
committerAlejandro Colomar <alx@kernel.org>2024-03-12 18:25:19 +0100
commita4ea5f76215dcf1d8d017eb65ab12919ccf09f3f (patch)
tree1087a6ee27db5639893a1c290ced79ea4c69a0b6
parent347f1ebaaf2495196bbb2efe8a74e87cc797d944 (diff)
logb.3: floor(log2(fabs(x))) has rounding errors
Link: <https://inbox.sourceware.org/libc-alpha/20240305150131.GD3653@qaa.vinc17.org/T/#m3ceecda630012995339bcc5448fee451cf277a8b> Reported-by: Vincent Lefevre <vincent@vinc17.net> Suggested-by: Vincent Lefevre <vincent@vinc17.net> Cc: Morten Welinder <mwelinder@gmail.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man3/logb.35
1 files changed, 3 insertions, 2 deletions
diff --git a/man3/logb.3 b/man3/logb.3
index 7a1ad2f4a..6d1cb5be8 100644
--- a/man3/logb.3
+++ b/man3/logb.3
@@ -57,9 +57,10 @@ If
.B FLT_RADIX
is 2,
.BI logb( x )
-is equal to
+is similar to
.BI floor(log2(fabs( x )))\f[R],\f[]
-except that it is probably faster.
+except that the latter may give an incorrect integer
+due to intermediate rounding.
.P
If
.I x