// a < b && b >= c
// Analysis
	if(Math.abs(a==0) && Math.abs(c==0))
		min = "green";
	else if(Math.abs(a==0) || (Math.abs(a)>Math.abs(c) && Math.abs(c)!=0))
		min= "blue";
	else
		min = "red";
This half of the code takes care of the situations where the initial test failed, and we know that 'a' is definately less than 'b'. This subsection of code tests the situations where 'b' is greater than or equal to 'c'.

In the event that 'b' is the only value that is changing, it is assigned to the min varialble (min = "green";).

If either 'a' or 'c' is not zero, the code then test to see if 'a' is equal to 0. If it is, or if 'a' is greater than 'c' and 'c' is not zero, 'c' is assigned to the min variable. In all other situations, 'a' can safely be assumed to be the minimum, or at least sharing the minimum value with 'c'.

Close Window