Let\'s say that I know the probability of a \"success\" is P. I run the test N times, and I see S successes. The test is akin to tossing an unevenly weighted coin (perhaps
I think you want to evaluate the incomplete beta function.
There's a nice implementation using a continued fraction representation in "Numerical Recipes In C", chapter 6: 'Special Functions'.