摘要
当报表的数据精度降低时 ,由传统四舍五入方法产生的某些行、列或整个报表的累计舍入误差可能超过可接受的范围。介绍了一种用于调整由报表数据的精度降低所产生的误差的算法。算法的基本原理是从报表的左上角数据项开始 ,按逐行或逐列的方式对报表中每一数据项经四舍五入后的舍入误差按 1∶1的比例分别传递给其右方和下方的数据项 ;对于只有右方或下方数据项的数据项 ,则将舍入误差全部传递给右方或下方数据项 ;对于没有右方和下方数据项的数据项 ,则丢弃舍入误差。并对该算法与传统的四舍五入方法产生的单个数据项误差以及整行、整列和整个报表的最大累计误差进行了比较 ,结果表明该算法可以降低累计误差。最后用C语言给出了算法的详细描述。
When the data precision is decreased, the maximum accumulative error of certain row, certain column or the whole report may go beyond limit. In this paper, an algorithm used to adjust errors resulted from the change of data precision in reports is introduced. The basic principle of the algorithm is to transfer half of the round error of each item to its' right-following item and bottom-following item respectively, from the top-left data item to the bottom-right item. If a item only has right - following item or bottom-following item, then to transfer the round error to right following item or bottom-following item. The error of a data item and the maximum accumulated errors in a row, a column or whole report produced by traditional method are compared with that produced by new algorithm in theory. The result indicated that the new algorithm can reduce the maximum accumulated errorsin a row, a column, and whole report. Finally, the program is presented in C language.
出处
《抚顺石油学院学报》
EI
2001年第3期58-60,共3页
Journal of Fushun Petroleum Institute
关键词
报表
矩阵
舍入误差
数据精度
算法
Reports
Matrix
Rounding error
Data precision
Algorithm