R/int_sign.R

#' A fast and integer-based `sign()`
#'
#' @param x Integer or double vector.
#'
#' @returns
#' An integer vector denoting the sign, -1 for negatives, 1 for positives and 0
#' for when `x == 0`.
#'
#' @export
int_sign <- cpp_int_sign

Try the cheapr package in your browser

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

cheapr documentation built on April 4, 2025, 4:25 a.m.