Question Details

No question body available.

Tags

r integrate

Answers (1)

March 31, 2026 Score: 2 Rep: 35,010 Quality: Medium Completeness: 100%

help("integrate") already instructs us not to do that:

When integrating over infinite intervals do so explicitly, rather than just using a large number as the endpoint.

And as you've shown, for a good cause:

library(stats)

integrate(dnorm, 0, .Machine$integer.max) #> 0 with absolute error < 0

integrate(dnorm, 0, Inf) #> 0.5 with absolute error < 4.7e-05

Well, you can use anything larger than .Machine$integer.max*1e299, but why would you do that?!!

Looking at the source code we can see what's going on:

if(is.finite(lower) && is.finite(upper)) { wk