dectolong()

Converts a decimal value to a long integer.

Syntax

mint dectolong(dec_t *np, int4 *lngp);
  1. np is a pointer to the decimal structure to convert to an int4 integer.
  2. lngp is a pointer to an int4 integer 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 2,147,483,647.
Important: Even though the function name is "dectolong", it takes a 4-byte int pointer as argument, and converts the decimal to an INTEGER equivalent.