[m-dev.] diff: int.m: fix bug in `div'

Thomas Charles CONWAY conway at cs.mu.oz.au
Tue Nov 25 08:49:28 AEDT 1997


Fergus Henderson, you write:
> Index: tests/hard_coded/division_test.m
> ===================================================================
> RCS file: /home/mercury1/repository/tests/hard_coded/division_test.m,v
> retrieving revision 1.2
> diff -u -r1.2 division_test.m
> --- division_test.m	1997/03/23 19:44:01	1.2
> +++ division_test.m	1997/11/24 14:22:19
> @@ -13,6 +13,8 @@
>  
>  main -->
>  	(
> +		{ quot_test(3, 8, 0, 3) },		% 3 / 8 = 0 + 3/8
> +		{ quot_test(5, 8, 0, 5) },		% 5 / 8 = 0 + 5/8
>  		{ quot_test(7, 2, 3, 1) },		% 7 / 2 = 3 + 1/2
>  		{ quot_test(100, 13, 7, 9) }		% 100 / 13 = 7 + 9/13
>  	->
> @@ -21,6 +23,8 @@
>  		io__write_string("`//' test failed\n")
>  	),
>  	(
> +		{ rem_test(3, 8, 0, 3) },		% 3 / 8 = 0 + 3/8
> +		{ rem_test(5, 8, 0, 5) },		% 5 / 8 = 0 + 5/8
>  		{ rem_test(7, 2, 3, 1) },		% 7 / 2 = 3 + 1/2
>  		{ rem_test(100, 13, 7, 9) }		% 100 / 13 = 7 + 9/13
>  	->
> @@ -29,6 +33,8 @@
>  		io__write_string("rem test failed\n")
>  	),
>  	(
> +		{ div_test(3, 8, 0, 3) },		% 3 / 8 = 0 + 3/8
> +		{ div_test(5, 8, 0, 5) },		% 5 / 8 = 0 + 5/8
>  		{ div_test(7, 2, 3, 1) },		% 7 / 2 = 3 + 1/2
>  		{ div_test(100, 13, 7, 9) }		% 100 / 13 = 7 + 9/13
>  	->
> @@ -37,6 +43,8 @@
>  		io__write_string("div test failed\n")
>  	),
>  	(
> +		{ mod_test(3, 8, 0, 3) },		% 3 / 8 = 0 + 3/8
> +		{ mod_test(5, 8, 0, 5) },		% 5 / 8 = 0 + 5/8
>  		{ mod_test(7, 2, 3, 1) },		% 7 / 2 = 3 + 1/2
>  		{ mod_test(100, 13, 7, 9) }		% 100 / 13 = 7 + 9/13
>  	->

None of these contain -ve numbers. Surely if rounding is an
issue, there should be some test cases to check this.

Thomas
-- 
ZZ:wq!
^X^C
Thomas Conway               				      conway at cs.mu.oz.au
AD DEUM ET VINUM	  			      Every sword has two edges.



More information about the developers mailing list