Hi guys, This is the code for binary search on real and float numbers
#include<bits/stdc++.h>
using namespace std;
//We want to find an element which a<0.0000001
const float target = 0.0000001;
int main()
{
float l=0.00000000,r=100000.00000000;
cout << l << " " << r;
while((r-l)>0.00001){
float mid = (float)((l+r)/2);
cout << mid << endl;
if(mid>target) r=mid;
else l=mid;
}cout << l;
}
But it will stop when it reaches 10 to power -5 what can I do to make it go until 10 to power -18?