[libc-commits] [PATCH] D115828: [libc] Implement correctly rounded log2f based on RLIBM library.
Santosh Nagarakatte via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Dec 23 09:37:50 PST 2021
santoshn added a comment.
Dear Paul,
I was wondering how you are testing other rounding modes other than round-to-nearest-ties-to-even.
The coefficients that we are using are identical.
double r = __llvm_libc::fputil::polyeval(
d, extra_factor, 0x1.71547652bd4fp+0, -0x1.7154769b978c7p-1,
0x1.ec71a99e349c8p-2, -0x1.720d90e6aac6cp-2, 0x1.5132da3583dap-2);
Now this double value "r" needs to be rounded according to the target rounding mode.
The cast on line 142 in the current patch is doing static_cast<float>(r). I assume it is just rounding it to round-to-nearest ties to even.
I am seeing that these coefficients are producing correctly rounded results for the round-to-nearest-ties-to-even.
Further when the double value is specifically rounded to the target rounding mode, it is producing the correctly rounded results for them.
If possible, can you tell me the double value (r) returned by the libc polynomial with the above coefficients for various rounding modes corresponding to the input (x=0x1.03a16ap+0)?
It should produce the same double value "r" for all rounding modes.
In my build, it produces r = 0x1.4cdc4c80p-6, which when rounded to any rounding mode produces the correctly rounded result.
Thanks,
Santosh
In D115828#3207913 <https://reviews.llvm.org/D115828#3207913>, @zimmermann6 wrote:
> Dear Santosh,
>
>> Have you commented out lines src/__support/FPUtil/PolyEval.h:38-42.
>
> yes:
>
> - a/libc/src/__support/FPUtil/PolyEval.h
>
> +++ b/libc/src/__support/FPUtil/PolyEval.h
> @@ -35,7 +35,7 @@ INLINE_FMA static inline T polyeval(T x, T a0, Ts... a) {
> } // namespace fputil
> } // namespace __llvm_libc
>
> -#ifdef LLVM_LIBC_ARCH_X86_64
> +#ifdef LLVM_LIBC_ARCH_X86_64_XXX
>
> #include "x86_64/PolyEval.h"
>
> Please find attached the log2f.cpp file I am using.
>
> Best regards,
> Paul
>
> - F21183270: log2f.cpp <https://reviews.llvm.org/F21183270>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115828/new/
https://reviews.llvm.org/D115828
More information about the libc-commits
mailing list