
30 GPGPU Programming for Games and Science
You are more familiar with the notation using fractions,
r
0
+ r
1
=
x
0
y
0
+
x
1
y
1
=
x
0
y
1
+ x
1
y
0
y
0
y
1
(2.31)
where the sum is computed by constructing the common denominator of the
two fractions. Observe that the components of the 2-tuple are computed us-
ing multiplication and addition of binary scientific numbers, something we
already know how to do with a computer implementation (class
BSNumber).
Subtraction is defined similarly:
r
0
− r
1
=(x
0
∗ y
1
− x
1
∗ y
0
,y
0
∗ y
1
) (2.32)
Multiplication of two ratios is defined as
r
0
∗ r
1
=(x
0
∗ x
1
,y
0
∗ y
1
) (2.33)
where in fraction notation,
r
0
r
1
=
x
0
y
0
x
1
y
1
=
x
0
x
1
y
0
y
1
(2.34)
Division is similarly defined a