* Home
* FAQ
* Tools
+ Games
+ GNU bc
+ Interesting
+ Stuff
+ Links



1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
1 
 
^{2}/_{3} 
^{3}/_{4} 
^{4}/_{5} 
^{5}/_{6} 
^{6}/_{7} 
^{7}/_{8} 
^{8}/_{9} 
^{9}/_{10} 
^{10}/_{11} 
^{11}/_{12} 
^{12}/_{13} 
2 
^{2}/_{3} 
 
^{6}/_{5} 
^{4}/_{3} 
^{10}/_{7} 
^{3}/_{2} 
^{14}/_{9} 
^{8}/_{5} 
^{18}/_{11} 
^{5}/_{3} 
^{22}/_{13} 
^{12}/_{7} 
3 
^{3}/_{4} 
^{6}/_{5} 
 
12 
^{5}/_{2} 
2 
^{9}/_{4} 
^{24}/_{11} 
^{7}/_{2} 
^{10}/_{3} 
^{31}/_{8} 
4 
4 
^{4}/_{5} 
^{4}/_{3} 
12 
 
^{20}/_{9} 
^{12}/_{5} 
^{28}/_{11} 
^{8}/_{3} 
^{36}/_{13} 
^{20}/_{7} 
^{44}/_{15} 
3 
5 
^{5}/_{6} 
^{10}/_{7} 
^{5}/_{2} 
^{20}/_{9} 
 
10 
^{65}/_{6} 
^{40}/_{3} 
^{65}/_{12} 
6 
1025


146


^{20}/_{3} 
6 
^{6}/_{7} 
^{3}/_{2} 
2 
^{12}/_{5} 
10 
 
18 
24 
^{14}/_{3} 
5 
^{62}/_{15} 
4 
7 
^{7}/_{8} 
^{14}/_{9} 
^{9}/_{4} 
^{28}/_{11} 
^{65}/_{6} 
18 
 
56 
^{9}/_{2} 
130


31


10923


2212


^{36}/_{7} 
8 
^{8}/_{9} 
^{8}/_{5} 
^{24}/_{11} 
^{8}/_{3} 
^{40}/_{3} 
24 
56 
 
^{72}/_{17} 
^{40}/_{9} 
^{88}/_{19} 
^{24}/_{5} 
9 
^{9}/_{10} 
^{18}/_{11} 
^{7}/_{2} 
^{36}/_{13} 
^{65}/_{12} 
^{14}/_{3} 
^{9}/_{2} 
^{72}/_{17} 
 
130


3


32767


1434


28 
10 
^{10}/_{11} 
^{5}/_{3} 
^{10}/_{3} 
^{20}/_{7} 
6 
5 
130


31


^{40}/_{9} 
130


3


 
2050


119


20 
11 
^{11}/_{12} 
^{22}/_{13} 
^{31}/_{8} 
^{44}/_{15} 
1025


146


^{62}/_{15} 
10923


2212


^{88}/_{19} 
32767


1434


2050


119


 
124 
12 
^{12}/_{13} 
^{12}/_{7} 
4 
3 
^{20}/_{3} 
4 
^{36}/_{7} 
^{24}/_{5} 
28 
20 
124 
 
Table 1.  (x^{1} XOR y^{1})^{1}
Explanation
To understand this page, you'll need to know about binary numbers, fractions and
the bitwise logic function XOR. If you don't know about any of those, this page
probably isn't for you...:)
When considering bitwise operations such as XOR, it is almost always assumed that the
two operands and the result will all be integers. No consideration is therefore given
to what the result of the calculation might be if either or both of the operands is
nonintegral; How should the bits after the binary point be handled?
Fortunately, the process for bitwise XORing two values extends naturally to those
extra bits. e.g.:
34_{d} XOR 23_{d}
= 100010_{b} XOR 010111_{b}
= 110101_{b}
= 53_{d}
...and:
34.125_{d} XOR 23.375_{d}
= 100010.001_{b} XOR 010111.011_{b}
= 110101.010_{b}
= 53.25_{d}
Table 1 then, tabulates the reciprocal of the XOR of reciprocals of the row and column.
e.g.:
Table_1(8, 4)
= 1/(1/8 XOR 1/4)
= 1/(1/1000_{b} XOR 1/100_{b})
= 1/(0.001_{b} XOR 0.01_{b})
= 1/(0.011_{b})
= 1/(3/8_{d})
= 8/3
... which is indeed the value in Table 1, row 8, column 4.
Repeating binary fractions
So far our examples have deliberately avoided the awkward situation that arises with
nonterminating binary fractions. Again the XOR rules extend naturally, but we now
have to check that the (eventually) repeating pattern of the bits in each operand
combines fully with the other. N.B. Since it can be proved that the repeat cycle length
of a result is equal to the lowest common multiple of the repeat cycle lengths of the
operands, it can also be proved that all results will be rational when both operands are
rational. Here's a few examples:
Table_1(9, 10)
= 1/(1/9 XOR 1/10)
= 1/(1/1001_{b} XOR 1/1010_{b})
= 1/(0.{000111}..._{b} XOR 0.0{0011}..._{b})
 cycle lengths of 6 and 4
= 1/(0.0{000010111101}..._{b})
 cycle length = 12 = LCM(6,4)
= 1/(0.1_{b}
* 000010111101_{b}/(10_{b}^1100_{b}1))
= 1/(0.5 * 189/(2^121))
 12, (1100_{b}) is from the cycle length
= 1/(0.5 * 189/4095)
= 1/(189/8190)
= 1/(3/130)
= 130/3
Table_1(3, 12)
= 1/(1/3 XOR 1/12)
= 1/(1/11_{b} XOR 1/1100_{b})
= 1/(0.{01}..._{b} XOR 0.00{01}..._{b})
 both cycle lengths are 2
= 1/(0.01{00}..._{b})
 cycle length = 2 = LCM(2,2)
= 1/(0.01_{b})
 repeating zeroes mean nothing and can be cancelled
= 1/(1/4_{d})
= 4
Table_1(6, 12)
= 1/(1/6 XOR 1/12)
= 1/(1/110_{b} XOR 1/1100_{b})
= 1/(0.0{01}..._{b} XOR 0.00{01}..._{b})
 which is equivalent to...
= 1/(0.00{10}..._{b} XOR 0.00{01}..._{b})
 both cycle lengths are again 2
= 1/(0.00{11}..._{b})
 cycle length = 2 = LCM(2,2)
= 1/(0.01{00}_{b})
 repeating ones can be rounded up to a 1 and repeating zeroes
= 1/(0.01_{b})
 ...and repeating zeroes mean nothing and can be cancelled
= 1/(1/4_{d})
= 4
Now, the XOR result of two integers holds to (among others) two rules:
 x XOR y = y XOR x
 x XOR (x XOR y) = y
Unfortunately the last two examples prove that when the operands are not integers
that the second rule must fail; Both return the same result, meaning that
( 1/12 XOR 1/4) should return both 1/6 and
1/3 as the result. This is clearly impossible.
Exercises

Evaluate (x XOR y) for the following:

x = 6, 12

x = 123, 1234

x = 365, 676

Evaluate (x^{1} XOR y^{1})^{1} for the following
(three are in the above table but show working for all):

x = 5, y = 6

x = 6, y = 7

x = 31, y = 33

x = 3, y = 43

x = 9, y = 11

Examine and discuss the results of the function
f(x) = ((2^{x}1)^{1} XOR (2^{x}+1)^{1})^{1}
for positive integral x.

Prove whether the pattern ^{n}/_{(n+1)} in row and column continues
indefinitely.

Identify and discuss the problem causing the dichotomy with 3, 6, 12 and 4 described
above. (Hint: 0.00{1}... = 0.01; or does it? Should it in the case of XOR?)
Notes

The floating point XOR function is implemented as xorf(x,y) for the GNU bc
programming language in the logic.bc file from this
website's GNU bc page.

The HTML for Table 1 was generated by another, Javascript containing, page whose inner
HTML attribute was opened to pull the source directly. As a result, this page requires
no Javascript at all! A version of that very generator page is available
here.
