instance method
Numeric#truncate
() -> ::Integer
(::Integer ndigits) -> (::Integer | ::Numeric)
truncate(digits = 0) → integer or float
numeric.c
View on GitHub ↗
static VALUE
num_truncate(int argc, VALUE *argv, VALUE num)
{
return flo_truncate(argc, argv, rb_Float(num));
}
Returns self truncated (toward zero) to a precision of digits decimal digits.
Numeric implements this by converting self to a Float and invoking Float#truncate.