R/calc_half.R

Defines functions calc_half

Documented in calc_half

#' Calculate half the value of x
#' @param x an \link{even_number} to take the half of
#' @return an \link{odd_number}
#' @export
calc_half <- function(x) {
  if (class(x) != "even_number") {
    stop("'x' must be an 'even_number'")
  }

  odd_number(as.numeric(x) / 2)
}
richelbilderbeek/travisrs3 documentation built on Jan. 2, 2020, 9:52 a.m.