Smallint and ESmallint types

The EGL Smallint type is a value type that lets you create a four-byte value that ranges from -32,768 to 32,767, inclusive, with no decimal places. In Eclipse IDE for EGL Developers, the type definition for Smallint is ESmallint.

EGL package name

eglx.lang

Example use
Type detail
In the following detail, the Operation annotation indicates that the specified operation is available. For example, use “==” to compare two values, not “$EQ”. Two exceptions are the widen and narrow operations, which are invoked during data conversions; for example, when the as operator is used.
externalType ESmallint extends ENumber type ClassType

/**
  * {@Operation +} A unary plus (has no effect on the numeric value).
  */
   static function $Plus(value ESmallint in) returns (EInt) {@Operation{"+"}};

/**
  * {@Operation +} Adds two numbers.
  */
   static function $Plus(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EInt) {@Operation{"+"}};

/**
  * {@Operation -} Negates the value.
  */
   static function $Minus(value ESmallint in) 
          returns (EInt) {@Operation{"-"}};

/**
  * {@Operation -} Subtracts one number from another.
  */
  static function $Minus(lvalue ESmallint in, rvalue ESmallint in) 
         returns (EInt) {@Operation{"-"}};

/**
  * {@Operation *} Multiplies two numbers.
  */
  static function $Multiply(lvalue ESmallint in, rvalue ESmallint in) 
         returns (EInt) {@Operation{"*"}};

/**
  * {@Operation /} Divides one number by another.
  */
   static function $Divide(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EDecimal) {@Operation{"/"}};

/**
  * {@Operation %} Computes the remainder of dividing one number by another.
  */
   static function $Modulo(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EInt) {@Operation{"%"}};

   /**
     * {@Operation **} Computes lvalue to the power of rvalue.
     */
   static function $PowerOf(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EFloat) {@Operation{"**"}};

/**
  * {@Operation <} Compares two numbers.
  */
   static function $LT(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EBoolean) {@Operation{"<"}};

/**
  * {@Operation >} Compares two numbers.
  */
   static function $GT(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EBoolean) {@Operation{">"}};

/**
  * {@Operation <=} Compares two numbers.
  */
   static function $LTE(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EBoolean) {@Operation{"<="}};

/**
  * {@Operation >=} Compares two numbers.
  */
   static function $GTE(lvalue ESmallint in, rvalue ESmallint in) 
          returns (EBoolean) {@Operation{">="}};

/**
  * {@Operation ==} Compares two numbers.
  */
   static function $EQ(lvalue ESmallint in, rvalue ESmallint in) 
          returns(EBoolean) {@Operation{"=="}};

/**
  * {@Operation !=} Compares two numbers.
  */
   static function $NEQ(lvalue ESmallint in, rvalue ESmallint in) 
          returns(EBoolean) {@Operation{"!="}};

/**
  * {@Operation widen} Converts a smallint to a number.
  */
   static function asNumber(value ESmallint in) 
          returns(ENumber) {@Operation{"widen"}};

/**
  * {@Operation narrow} Converts a decimal to a smallint.  Digits after the
  * decimal point are discarded.
  *
  * @throws TypeCastException if the decimal is out of range for a smallint.
  */
   static function asSmallint(value EDecimal in) 
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts a float to a smallint.  Digits after the
  * decimal point are discarded.
  *
  * @throws TypeCastException if the float is out of range for a smallint.
  */
   static function asSmallint(value EFloat in) 
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts an int to a smallint.
  *
  * @throws TypeCastException if the int is out of range for a smallint.
  */
   static function asSmallint(value EInt in) 
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts a string to a smallint.  The string is parsed
  * as follows: It may begin with an optional + or - sign.  After the sign there
  * must be a sequence of one or more digit characters.  Nothing may follow the
  * digits.  The digits in the string must be within the valid range for a smallint.
  *
  * @throws TypeCastException if the string can't be parsed into a smallint.
  */
   static function asSmallint(value EString in) 
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts a smallfloat to a smallint.  Digits after the
  * decimal point are discarded.
  *
  * @throws TypeCastException if the smallfloat is out of range for a smallint.
  */
   static function asSmallint(value ESmallfloat in) 
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts a bigint to a smallint.
  *
  * @throws TypeCastException if the bigint is out of range for a smallint.
  */
   static function asSmallint(value EBigint in)
          returns(ESmallint) {@Operation{"narrow"}};

/**
  * {@Operation narrow} Converts a number to a smallint.  Digits after the
  * decimal point are discarded.
  *
  * @throws TypeCastException if the number is out of range for a smallint.
  */
   static function asSmallint(value ENumber in) 
          returns(ESmallint) {@Operation{"narrow"}};
end
Comments
Compatibility
Table 1. Compatibility
Target Issue
Java No issues.
JavaScript No issues.