next up previous contents
Next: Functions on Type t_text Up: Primitives Previous: Functions on Type t_bool   Contents

Functions on Type t_int

t_bool
operator==(t_int i1, t_int i2)

Returns true if i1 and i2 are equal, and false otherwise.

t_bool
operator!=(t_int i1, t_int i2) =
  operator!(operator==(i1, i2))

t_int
operator+(t_int i1, t_int i2)

Returns the integer sum i1 + i2 unless it lies outside the implementation-defined range, in which case evaluation halts with a runtime error.

t_int
operator-(t_int i1, t_int i2)

Returns the integer difference i1 - i2 unless it lies outside the implementation-defined range, in which case evaluation halts with a runtime error.

t_int
operator-(t_int i) =
  operator-(0, i)

t_int
operator*(t_int i1, t_int i2)

Returns the integer product i1 * i2 unless it lies outside the implementation-defined range, in which case evaluation halts with a runtime error.

t_int
_div(t_int i1, t_int i2)

Returns the integer quotient i1 / i2 (that is, the floor of the real quotient) unless it lies outside the implementation-defined range, in which case evaluation halts with a runtime error. This error is possible only if i2 is zero or if i2 is -1 and i1 is the largest implementation-defined negative number.

t_int
_mod(t_int i1, t_int i2) =
  operator-(i1, operator*(_div(i1,i2), i2))

t_bool
operator<(t_int i1, t_int i2) =
{
  int ii1 = i1, ii2 = i2; // convert to C++ integers
  if (ii1 < ii2) return true; else return false;
}

t_bool
operator>(t_int i1, t_int i2) =
  operator<(i2, i1)

t_bool
operator<=(t_int i1, t_int i2) =
{
  int ii1 = i1, ii2 = i2; // convert to C++ integers
  if (ii1 <= ii2) return true; else return false;
}

t_bool
operator>=(t_int i1, t_int i2) =
  operator<=(i2, i1)

t_int
_min(t_int i1, t_int i2) =
{ if (operator<(i1, i2)) return i1; else return i2; }

t_int
_max(t_int i1, t_int i2) =
{ if (operator>(i1, i2)) return i1; else return i2; }


next up previous contents
Next: Functions on Type t_text Up: Primitives Previous: Functions on Type t_bool   Contents
Allan Heydon, Roy Levin, Timothy Mann, Yuan Yu