signum method

int signum()

Returns an integer indicating the sign of this value.

  • if this value is > 0, returns 1
  • if this value is < 0, returns -1
  • if this value is = 0, returns 0
  • if this value is NaN, returns 0

@return an integer indicating the sign of this value

Implementation

int signum() {
  if (hi > 0) return 1;
  if (hi < 0) return -1;
  if (lo > 0) return 1;
  if (lo < 0) return -1;
  return 0;
}