R/eps.R

Defines functions eps

Documented in eps

##
##  e p s . R
##


eps <- function(x = 1.0) {
    stopifnot(is.numeric(x))

    x <- max(abs(x))

    if (x <  .Machine$double.xmin) {
        e <- .Machine$double.xmin
    } else {
        e <- 2^floor(log2(x)) * .Machine$double.eps
    }
    e
}

Try the pracma package in your browser

Any scripts or data that you put into this service are public.

pracma documentation built on March 19, 2024, 3:05 a.m.