r15474 - gnucash/trunk/src/engine/test - Do not intentionally divide by zero in test-numeric

Derek Atkins warlord at MIT.EDU
Wed Jan 31 09:51:32 EST 2007


Andreas Köhler <andi5 at cvs.gnucash.org> writes:

> @@ -632,6 +635,9 @@
>  		gint64 nb = rand();
>  		gint64 ne;
>  
> +		/* avoid 0 */
> +		if (nb == 0) { i--; continue; }
> +
>  		/* avoid overflow; */
>  		na /= 2;
>  		nb /= 2;

You should probably put this test after the divide-by-2, because
if rand() returns 1 for nb then the nb /= 2 -> 1/2 -> 0.

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list