Integer Arithmetic

The computer relies on arithmetic. Here we test a variety of arithmetic operations expressed as 32 bit two's complement binary numbers (Java's int).
 
eg.ArithmeticFixture
x y + - * /
0 0 0 0 0 0
System.DivideByZeroException: Attempted to divide by zero.
   at eg.ArithmeticFixture.doCell(Parse cell, Int32 column) in C:\projects\fit\cs\src\eg\ArithmeticFixture.cs:line 29
   at fit.Fixture.doCells(Parse cells) in C:\projects\fit\cs\src\fit\Fixture.cs:line 84
1 2 3 -1 2 0.5
System.FormatException: Input string was not in a correct format.
   at System.Number.ParseInt64(String s, NumberStyles style, NumberFormatInfo info)
   at System.Int64.Parse(String s)
   at fit.PrimitiveFixture.parseLong(Parse cell) in C:\projects\fit\cs\src\fit\PrimitiveFixture.cs:line 13
   at fit.PrimitiveFixture.check(Parse cell, Int64 actual) in C:\projects\fit\cs\src\fit\PrimitiveFixture.cs:line 37
   at eg.ArithmeticFixture.doCell(Parse cell, Int32 column) in C:\projects\fit\cs\src\eg\ArithmeticFixture.cs:line 29
   at fit.Fixture.doCells(Parse cells) in C:\projects\fit\cs\src\fit\Fixture.cs:line 84
1 -1 0 2 -1 -1
10000 10000 20000 0 100000000 1
100000 100000 200000 0 10000000000 expected
1410065408 actual
1
1000000 1000000 2000000 0 1000000000000 expected
-727379968 actual
1


fit.Summary
run date 10/1/2002 3:07:44 PM
output file report\arithmetic.html
input update 10/1/2002 3:07:30 PM
input file ..\doc\arithmetic.html
counts 20 right, 2 wrong, 0 ignored, 2 exceptions

Document prepaired by Ward Cunningham
First Version July 11, 2002
Last Update August 17, 2002