This paper describes our experience developing polynomial approximations for trigonometric functions that produce correctly rounded results for multiple representations and rounding modes using the RLIBM approach. A key challenge with trigonometric functions concerns range reduction with "pi", which reduces a given input in the domain of a 32-bit float to a small domain. Any rounding error in the value of "pi" is amplified during range reduction, which can result in wrong results. We describe our experience implementing fast range reduction techniques that maintain a large number of bits of "pi" both with floating-point and integer computations. The resulting implementations for trigonometric functions are fast and produce correctly rounded results for all inputs for multiple representations up to 32-bits with a single implementation.
翻译:本文阐述了我们采用RLIBM方法为三角函数开发多项式逼近的经验,该方法可为多种数据表示形式和舍入模式生成正确舍入的结果。三角函数的一个关键挑战在于涉及"π"的区间缩减,该操作将32位浮点数定义域内的给定输入缩减至一个小区间。"π"值的任何舍入误差在区间缩减过程中会被放大,可能导致错误结果。我们介绍了实现快速区间缩减技术的经验,该技术通过浮点与整数计算同时保持"π"的高精度表示。最终实现的三角函数计算方案具有高效性,并能通过单一实现为所有输入(支持至32位的多种数据表示)生成正确舍入的结果。