This file is for programmers. If you are not a programmer, you may not understand some of the example programs, but you might want to read this anyway. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ To show you why some bugs are caused and not easily fixed, consider this program: Var I, J : Integer; ³ main() Begin ³ { int i, j; I := 10000 * 100 div 50; ³ i = 10000 * 100 / 50; J := 10000 div 50 * 100; ³ j = 10000 / 50 * 100; Writeln( I, ' = ', J ); ³ printf( "%d = %d\n", i, j ); End. ³ } The result should be that I is equal to J. Now a similar program: Var I, J, A, B, C : Integer; ³ main() Begin ³ { int i, j, a, b, c; A := 10000; ³ a = 10000; B := 100; ³ b = 100; C := 50; ³ c = 50; I := A * B div C; ³ i = a * b / c; J := A div C * B; ³ j = a / c * b; Writeln( I, ' = ', J ); ³ printf( "%d = %d\n", i, j ); End. ³ } Now the result is that I is not equal to J. Mathematicians usually tell computer programmers that it's crazy to have a language that does this. Yet we have to live with it. This has been a major cause of SRE bugs; many times nothing happens until the empires are large. (Replace 10000 by 3 and the bug won't appear!) That makes debugging slow and painful because that kind of problem isn't something that is obvious late at night. Furthermore, if you try typing in "A*B DIV C" into the debugger, it gives the right answer, but when you run it, it won't give the right answer! ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Conclusion: programming languages need a "SuperInteger" or something larger than LongInt so that SRE and other programs that work with large numbers will work correctly. Remember this when you write your own program and you can't figure out why in the world 1000 * 5000 / 1000 is not always 5000. Try rearranging the formula! Have fun! ;) Amit Patel, programmer at the Solar Realm ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ P.S. If you still haven't figured out why this happens, type in: I := 10000 * 100; ³ i = 10000 * 100; and see what happens. 1 million won't fit into an integer, so it causes strange results (or compile time errors if you use numbers and not variables). Integers can store up to 32767, which is NOT enough to store how much money you have in SRE! Using "long" integers only delays the problem. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ