[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
Tue Dec 21 05:12:05 PST 2021


santoshn added a comment.

Dear Paul,

Thanks,  Here is a polynomial with zero constant term that I regenerated with RLIBM. It produces correctly rounded results for all rounding modes and inputs in our infrastructure. It should produce correct results for all representations that has 8 bits of exponents and precisions starting from 10 bits to 32-bits and for all rounding modes.

Polynomial: y=1.4426950408890186761112772728665731847286224365234375000000000000000000e+00 x^(1) + -7.2134752026802795299431636522058397531509399414062500000000000000000000e-01 x^(2) + 4.8089833837385143056053493637591600418090820312500000000000000000000000e-01 x^(3) + -3.6069150703943497759951242187526077032089233398437500000000000000000000e-01 x^(4) + 2.8934750971542422259830118491663597524166107177734375000000000000000000e-01 x^(5)

In D115828#3204271 <https://reviews.llvm.org/D115828#3204271>, @zimmermann6 wrote:

> Dear Santosh,
>
>> Yes, it has a non-zero constant term because it generates the correctly rounded round-to-odd result for a 34-bit floating point. When this is rounded to any FP representation with the 8 exponent bits and for any rounding mode in the standard, it produces the correctly rounded result. 
>> Here is our paper describing the result: https://people.cs.rutgers.edu/~sn349/papers/rlibmall-popl-2022.pdf
>>
>> We plugged this polynomial locally in our infrastructure which uses the same range reduction and the same quintic polynomial evaluation, it produces correctly rounded results for all inputs and all inputs.  Are you observing that it is not producing the correct result for some inputs?
>
> sorry I was not clear enough: can you generate with RLIBM a degree-5
> polynomial with double coefficients and a zero constant term that you can
> plug into the llvm-libc infrastructure (lines 131-132 of the current
> patch) and which produces correct-rounding for all rounding modes (like
> the polynomial generated by Sollya which I gave above).
>
> Best regards,
> Paul




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