[libc-commits] [PATCH] D115828: [libc] Implement correctly rounded log2f based on RLIBM library.

Paul Zimmermann via libc-commits libc-commits at lists.llvm.org
Tue Dec 21 07:19:47 PST 2021


       Dear Santosh,

> 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)

if I plug this polynomial into the llvm-libc framework as follows:

  double r = __llvm_libc::fputil::polyeval(
      d, extra_factor, 0x1.71547652b83f7p+0, -0x1.7154765134294p-1,
      0x1.ec709d3010d4p-2, -0x1.71591d4ab7a18p-2, 0x1.284ab6ada08d6p-2);

then I get 1 incorrect rounding for x=0x1.fc64e8p-1 and rounding to nearest,
and 1 incorrect rounding for x=0x1.197472p+0 and rounding down/towards zero
(for rounding up, all results are correctly rounded).

Best regards,
Paul


More information about the libc-commits mailing list