Binary search Algorithm Using internal Arduino Analogue Comparator

hello guys
i am new to this forum and Arduino and i am trying to perform Binary search algorithm in such a way that if AIN0(+vin) and AIN1(-vin) are used.
i know that by binary search algorithm it means that when AIN0( the guess in mine case connected to AC supply varying from 0-6v) when greater than AIN1(The Number in mine case and let suppose its 3 v) the output in ACO register is 1 while vice versa its 0.
Up till now my code works fine but how to check whether my AIN0 will be equal to AIN1 ?

the code is below please help me in implementing Binary search algorithm code.

// ANALOG COMPARATOR OUTPUT
//*********************************************************************
// if guess is not equal to number from random range
// then either when number(AIN1 -vin) is greater than guess(AIN0 +vin) then send as 0 on pin 5
// else if number is less then guess then send 1 on pin 5

if(ACSR & (1 << ACO)) // check status of comparator output flag
digitalWrite(LedPin, HIGH); // and mirror it to Pin 5
else
digitalWrite(LedPin, LOW);
delay(50);
//*********************************************************************

//*********************************************************************
//*********************************************************************
// if guess is equal to number from random range
if (AINp == AINn)
{
digitalWrite(compout,HIGH);
}
else
digitalWrite(compout,LOW);

//*********************************************************************
//*********************************************************************

compout is comparator output at pin 4.

how to check whether my AIN0 will be equal to AIN1 ?

With a comparator, you can't.