Floating-point Expression Precision Optimization Method Based on Multi-type Calculation Rewriting
Expression rewriting is an emerging method in the field of precision optimization.Its core idea is to transform an ex-pression into a semantically equivalent expression without changing its precision representation to improve precision.However,given the large number of transformation rules and the huge transformation space,the problem of the rewriting method is how to choose an appropriate transformation strategy.In response to the above problems,this paper proposes a precision optimization method for floating-point expressions based on multi-type calculation rewriting,which supports expressions including mathemati-cal function calculations and four arithmetic calculations,and implements an expression rewriting tool exprAuto.Unlike other precision optimization tools that focus on replacing sub-expressions,exprAuto pays more attention to transform the order of ex-pression operations.After the expression is simplified and mathematically transformed,exprAuto obtains different calculation or-ders through polynomial transformation,and tries to improve the precision by reducing the number of operations.Finally,ex-prAuto generates an equivalent set of expressions with different calculation orders and selects the final precision optimization re-sult through sorting screening and error detection.In this paper,41 expressions from the FPBench standard set and 18 approxi-mate polynomials of common mathematical functions are selected as test cases.After exprAuto optimization,the maximum error is reduced by 45.92%and the average error is reduced by 34.98%compared to the original expression.For 18 approximate poly-nomials,the maximum error is reduced by 58.35%,and the average error is reduced by 43.73%.Experimental results show that exprAuto can effectively improve the precision of expressions,especially polynomials.