使用小数计算错误估计 [英] Estimating error on calculations using decimals

查看:115
本文介绍了使用小数计算错误估计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用System.Decimals在我们正在开发一个.NET应用程序来表示数字。我知道小数的设计,以尽量减少由于舍入误差,但我也知道,某些数字的1/3,例如,不能表示为十进制所以一些计算将有小舍入误差。我相信,这个错误的幅度会非常的渺小和微不足道,但同事不同意。因此,我希望能够在错误的量级估计,由于在我们的应用程序四舍五入。举个例子,我们计算的运行总计交易,将每天做约10000交易,并有大约5-10十进制运算(ADD,SUB,DIV,MUL等)来计算总运行新运行总计收到的每笔交易,这将是一轮错误的巨头的顺序?为计算该程序的答案也将是不错的,所以我可以学习如何在将来这样做我自己。

We're currently using System.Decimals to represent numbers in a .NET application we're developing. I know that decimals are design to minimize errors due to rounding, but I also know that certain numbers, 1/3 for example, cannot be represented as a decimal so some calculations will have small rounding error. I believe the magnitude of this error will be very small and insignificant, however a colleague disagrees. I would therefore like to be able to estimate the order of magnitude of the error due to rounding in our app. Say, for example, we are calculating a running total of "deals" and will do about 10,000 "deals" per day and there are about 5-10 decimal operations (add, sub, div, mul etc.) to calculate the running total new running total for each deal received, what would be the order of magnate of round error? An answer with a procedure for calculating this would also be nice, so I can learn how to do this for myself in the future.

推荐答案

什么每个计算机科学家应该知道关于浮点运算进入细节上的浮点运算的序列的结果,估计误差给出的浮点类型的精度。我没有试过任何切实可行的方案,虽然如此,我很想知道,如果这是可行的。

What Every Computer Scientist Should Know About Floating-Point Arithmetic goes into detail on estimating the error in the result of a sequence of floating point operations, given the precision of the floating point type. I haven't tried this on any practical program, though, so I'd be interested to know if it's feasible.

这篇关于使用小数计算错误估计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆