Why I am getting one wrong answer?

Here is my code

#include<bits/stdc++.h>
using namespace std;
double findProb(int people){
    double ans = 1;
    double n = 365;
    for(int i = 0;i<people;i++)
        ans = ans * ((n-i)/365);
    return 1-ans;
}
int main(){
    double probablity;
    cin>>probablity;
    int low = 1,high = 366,ans = 366;
    while (low<=high){
        int mid = (low+high)/2;
        if(findProb(mid) >= probablity){
            ans = mid;
            high = mid-1;
        }
        else{
            low = mid+1;
        }
    }
    cout<<ans;
    return 0;
}

I guess it is not working on p=1, but I wonder why?

@shivama_700 when p == 1 answer should be 366, you need to add an if condition in the beginning to tackle this edge case.

But why I have to add this condition explicitly?

this has to with the inability of 6 decimal places to store correct answer when its error is below 10^-6, since the findProb of 95 is 0.999999, everyone above 100 would have findProb 1 which is wrong but it gets rounded off. Since the probability provided has only upto 6 decimal places answer is correct for other values.