More accurate summations [was Re: This math scares me]

jurgen.defurne at philips.com jurgen.defurne at philips.com
Mon Mar 19 07:02:33 EST 2001


grante at visi.com@SMTP at python.org on 17/03/2001 17:42:57
Sent by:	python-list-admin at python.org
To:	python-list at python.org@SMTP
cc:	 
Subject:	Re: More accurate summations [was Re: This math scares me]
Classification:	


On 17 Mar 2001 03:43:57 GMT, Edward Jason Riedy <ejr at cs.berkeley.edu> wrote:
>And <jurgen.defurne at philips.com> writes:
> -
> - Try summing all financial operations of one day together, or
> - better, all operations involving percentages and then adding them
> - together : cumulative errors.
>
>More concretely, look at the Vancouver Stock Exchange index's
>problems of the late 70s-early 80s.  They had chosen to
>truncate floating point values rather than round them, causing
>a downward drift of around 20 points a month[1].
>
>You could say that's because of poor handling of floating-point
>arithmetic, and you'd be right.  However, just about every
>inaccuracy in floating-point financial calculations can be
>attributed to poor handling of fp arithmetic.

The problem is that proper handling of fp arithmetic is not
easy even though it appears trivial to the uneducated. It
requires quite a bit of knowlege, thought, and work. After one
undergrad numerical analysis class, I know that I don't know
enough to do it right.

>That doesn't mean floating point is a poor choice for all
>financial programs.  Indeed, the HP financial calculators _all_
>use floating point, although decimal.

That was (I think) the original topic: BCD floating point vs.
binary floating point.

--
Grant Edwards                   grante             Yow!  Now KEN is having
                                  at               a MENTAL CRISIS beacuse
                               visi.com            his "R.V." PAYMENTS are
                                                   OVER-DUE!!
--
http://mail.python.org/mailman/listinfo/python-list

And that is why abovementioned financial operations ARE all carried out using BCD, mostly supported
by hardware, or optimized libraries.

BTW, I have never heard about a library which supports the x87 extensions for using 18 decimal BCD
math. This is based on the internal 80-bit FP format of the x87 numeric processors.

Jurgen




More information about the Python-list mailing list