(11C) Arithmetic with Fractions
09-16-2018, 11:41 PM (This post was last modified: 09-18-2018 07:07 PM by Thomas Klemm.)
Post: #5
 Thomas Klemm Senior Member Posts: 1,547 Joined: Dec 2013
RE: (11C) Arithmetic with Fractions
(09-16-2018 10:06 PM)Dieter Wrote:  A better algorithm would first determine the LCM of the denominators.

But even then the nominator numerator would be 100 instead of 31 due to rounding to 10 significant digits:

\begin{align*} \frac{123,456,799}{123,456}-\frac{988,297,396}{988,291} &= \frac{123,456,799\times1,537}{123,456\times1,537}-\frac{988,297,396\times192}{988,291\times192} \\ &= \frac{189,753,100,063}{189,751,872}-\frac{189,753,100,032}{189,751,872} \\ &= \frac{189,753,100,063-189,753,100,032}{189,751,872} \\ &= \frac{31}{189751872} \end{align*}

W. Kahan explains in the linked paper how to avoid this.

Kind regards
Thomas
 « Next Oldest | Next Newest »

 Messages In This Thread (11C) Arithmetic with Fractions - Gamo - 09-15-2018, 07:02 AM RE: (11C) Arithmetic with Fractions - Dieter - 09-16-2018, 04:58 PM RE: (11C) Arithmetic with Fractions - Thomas Klemm - 09-16-2018, 09:17 PM RE: (11C) Arithmetic with Fractions - Dieter - 09-16-2018, 10:06 PM RE: (11C) Arithmetic with Fractions - Steve Simpkin - 09-17-2018, 01:46 AM RE: (11C) Arithmetic with Fractions - Thomas Klemm - 09-16-2018 11:41 PM RE: (11C) Arithmetic with Fractions - Dieter - 09-18-2018, 06:51 PM RE: (11C) Arithmetic with Fractions - Valentin Albillo - 09-18-2018, 09:25 PM RE: (11C) Arithmetic with Fractions - Dieter - 09-18-2018, 10:38 PM RE: (11C) Arithmetic with Fractions - Massimo Gnerucci - 09-19-2018, 07:45 AM RE: (11C) Arithmetic with Fractions - Albert Chan - 09-17-2018, 01:12 AM RE: (11C) Arithmetic with Fractions - Albert Chan - 09-17-2018, 04:04 PM RE: (11C) Arithmetic with Fractions - Gamo - 09-17-2018, 03:47 AM RE: (11C) Arithmetic with Fractions - Carsen - 09-17-2018, 08:14 AM RE: (11C) Arithmetic with Fractions - Gamo - 09-17-2018, 09:40 AM RE: (11C) Arithmetic with Fractions - Albert Chan - 09-17-2018, 06:44 PM RE: (11C) Arithmetic with Fractions - Thomas Klemm - 09-18-2018, 07:19 PM RE: (11C) Arithmetic with Fractions - Thomas Klemm - 09-18-2018, 07:29 PM RE: (11C) Arithmetic with Fractions - Gamo - 09-22-2018, 06:33 AM RE: (11C) Arithmetic with Fractions - Dieter - 09-24-2018, 12:59 PM RE: (11C) Arithmetic with Fractions - Dieter - 09-24-2018, 05:29 PM

User(s) browsing this thread: 1 Guest(s)