d2 <- function (x, mean = 0, sd = 1, log = FALSE) (((x - mean)/sd)^2 - 1) * if (log) 1 else dnorm(x, mean, sd)/sd