[PATCH v2 2/3] manual: floor(log2(fabs(x))) has rounding errors
DJ Delorie
dj@redhat.com
Sat Mar 30 00:24:48 GMT 2024
Alejandro Colomar <alx@kernel.org> writes:
> -floating-point value. If @code{FLT_RADIX} is two, @code{logb} is equal
> -to @code{floor (log2 (fabs (x)))}, except
> -it's probably faster.
> +floating-point value. If @code{FLT_RADIX} is two, @code{logb (x)} is similar
> +to @code{floor (log2 (fabs (x)))}, except
> +that the latter may give an incorrect integer due to intermediate rounding.
So we're replacing "is equal to" with "is similar to", and replacing
"it's probably faster" (understatement ;) with a note about correctness.
I can't think of a different description that is both more correct and
more succinct, nor do I think it's worth the effort to try to come up
with such.
LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>
Also, if you could avoid unnecessary reformating, that would help with
reviews. Thanks!
More information about the Libc-alpha
mailing list