Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!hplabs!hp-pcd!hpsgpa!daver From: daver@hpsgpa.HP.COM (Dave Rabinowitz) Newsgroups: comp.sys.hp Subject: Re: HP28C Message-ID: <2790006@hpsgpa.HP.COM> Date: Tue, 27-Oct-87 04:31:07 EST Article-I.D.: hpsgpa.2790006 Posted: Tue Oct 27 04:31:07 1987 Date-Received: Fri, 30-Oct-87 02:20:53 EST References: <3969@watdcsu.waterloo.edu> Organization: HP Singapore IC Design Ctr Lines: 19 > When I compare the results of 253! from the programs below, I get > accuracy differences. What is the reason for this? > Results: 5.17346 09926 9 E 499 FACT function > 5.17346 09926 4 E 499 Program 2 > 5.17346 09928 2 E 499 Program 1 The exact result for 253! will have 500 digits, so there will be rounding errors whenever it is calculated with fewer than 500 digits. The FACT function, and all other built-in functions, carry extra significant digits to reduce the rounding errors in the final result, and the result is usually accurate to the last digit. When you run a program, each time a built-in function is completed the result is rounded to 12 digits and this rounded result is used in further calculations, so the result will not be as accurate as the built-in function, which uses at least 14 digits in all its calculations. The reason the two programs give different answers is that they do the multiplications in a different order, the first doing 253*252*251...*1 while the second does 1*2*3*...*253, which will lead to different rounding errors.