The output of a comparator is high (value= 1) when the non-inverting input is higher than the inverting input. When the positive input is lower, the output is zero. If the two input are equal, the output is undefined and it will keep the previous value.