trunc method

DD trunc()

Returns the integer which is largest in absolute value and not further from zero than this value. Special cases:

  • If this value is NaN, returns NaN.

@return the integer which is largest in absolute value and not further from zero than this value

Implementation

DD trunc() {
  if (isNaN()) return NaN;
  if (isPositive())
    return floor();
  else
    return ceil();
}