dectoint()

Converts a decimal value to a 2-byte integer.

Syntax

mint dectoint2(dec_t *np, mint *ip);
  1. np is a pointer to the decimal structure to convert to a mint type value.
  2. ip is a pointer to a mint variable.

Returns

Table 1. Return codes
Code Description
0 The conversion was successful.
<0 The conversion failed.
-1200 The magnitude of the decimal type number is greater than 32767.
Important: This functions takes a machine-dependent int pointer as argument (usually 4 bytes), but converts the decimal to a SMALLINT equivalent, with possible overflow errors.