One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes

One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes
复制标题

DOI:
10.1145/3498664
复制
发表时间:
2022-01
影响因子:
--
通讯作者:
Jay P. Lim;Santosh Nagarakatte
Jay P. Lim;Santosh Nagarakatte
中科院分区:
--
文献类型:
--
作者:
Jay P. Lim;Santosh Nagarakatte

文献摘要

被引文献

相似文献

用于浮点(FP)的主流数学库无法为所有输入生成正确的四舍五入结果。相比之下,CR-LIBM和RLIBM为具有一种舍入模式的特定FP表示提供了正确的舍入实现。对于具有新舍入模式或不同精度的表示,使用这样的库将会由于双重舍入而导致错误的结果。本文提出了一种新的方法来生成单个多项式近似,从而为多个舍入模式和多个精度配置的所有输入产生正确的舍入结果。为了为n位生成正确的舍入库,我们的关键思想是使用舍入到奇数模式为n+2位的表示生成多项式近似。我们证明了所得到的多项式近似对于标准中的所有五种舍入模式和具有k比特的多重表示都将产生正确的舍入结果,使得|E|+1<k≤n,其中|E|是表示中的指数比特数。与我们在RLIBM项目中之前的工作类似,当我们使用舍入到奇数模式生成n+2位的库时,我们近似得到正确的舍入结果。我们还通过将其构造为线性规划问题来生成多项式近似,但提出了对多项式生成的增强以处理从四舍五入到奇数的模式。我们的原型是第一个32位浮点库,它以IEEE标准中的所有舍入模式为所有输入生成正确的舍入结果,并使用单个多项式近似。它还可以为从10位到32位的任何FP配置生成正确的四舍五入结果,同时速度也快于主流库。
Mainstream math libraries for floating point (FP) do not produce correctly rounded results for all inputs. In contrast, CR-LIBM and RLIBM provide correctly rounded implementations for a specific FP representation with one rounding mode. Using such libraries for a representation with a new rounding mode or with different precision will result in wrong results due to double rounding. This paper proposes a novel method to generate a single polynomial approximation that produces correctly rounded results for all inputs for multiple rounding modes and multiple precision configurations. To generate a correctly rounded library for n-bits, our key idea is to generate a polynomial approximation for a representation with n+2-bits using the round-to-odd mode. We prove that the resulting polynomial approximation will produce correctly rounded results for all five rounding modes in the standard and for multiple representations with k-bits such that |E| +1 < k ≤ n, where |E| is the number of exponent bits in the representation. Similar to our prior work in the RLIBM project, we approximate the correctly rounded result when we generate the library with n+2-bits using the round-to-odd mode. We also generate polynomial approximations by structuring it as a linear programming problem but propose enhancements to polynomial generation to handle the round-to-odd mode. Our prototype is the first 32-bit float library that produces correctly rounded results with all rounding modes in the IEEE standard for all inputs with a single polynomial approximation. It also produces correctly rounded results for any FP configuration ranging from 10-bits to 32-bits while also being faster than mainstream libraries.