In its call to uniroot, power.t.test uses 1e7 as the upper bound for required N: n <- uniroot(function(n) eval(p.body) - power, c(2, 1e+07))$root So if the the required N > 1e7 then it fails with a uniroot error message: > power.t.test(delta = 1e-4, sd = .35, power = .8) Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07)) : f() values at end points not of opposite sign This can be fixed by increasing this limit, allowing a user-specified limit, or catching the uniroot error and increasing the limit only in the case. Similar errors occur when solving for quantities other than N (such as very small values of delta). Experienced users/statisticians can route around this problem by doing some math.

We often run tests with sample sizes greater than 10 million. Updating the R function manually to increase the limit is straightforward, but I advocate for increasing the default limit in the call to the uniroot function from to 1e+07 to 1e+08 so others don't need to worry about this. Thank you.

This is a nice example - I think - where the new uniroot() features can be made use off, in a nice way: No need to change the search interval (==> we keep 100% back compatibility for the cases it works), but allow uniroot() to search outside if necessary... However, as there are so many use cases - it seems - for calling this, I'm also adding a tolerance - so people can get nominally more precise results if desired.

(In reply to Martin Maechler from comment #2) Fixed in R-devel and R-patched {svn rev 67205 etc}