*intvlsrc, interval *intvldest);
</synopsis>
The function copies the interval variable that <literal>intvlsrc</literal>
points to into the variable that <literal>intvldest</literal> points to. Note
that you need to allocate the memory for the destination variable
before.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2 id="ecpg-pgtypes-decimal">
<title>The decimal Type</title>
<para>
The decimal type is similar to the numeric type. However it is limited to
a maximum precision of 30 significant digits. In contrast to the numeric
type which can be created on the heap only, the decimal type can be
created either on the stack or on the heap (by means of the functions
<function>PGTYPESdecimal_new</function> and
<function>PGTYPESdecimal_free</function>).
There are a lot of other functions that deal with the decimal type in the
<productname>Informix</productname> compatibility mode described in <xref
linkend="ecpg-informix-compat"/>.
</para>
<para>
The following functions can be used to work with the decimal type and are
not only contained in the <literal>libcompat</literal> library.
<variablelist>
<varlistentry id="ecpg-pgtypes-decimal-new">
<term><function>PGTYPESdecimal_new</function></term>
<listitem>
<para>
Request a pointer to a newly allocated decimal variable.
<synopsis>
decimal *PGTYPESdecimal_new(void);
</synopsis>
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-decimal-free">
<term><function>PGTYPESdecimal_free</function></term>
<listitem>
<para>
Free a decimal type, release all of its memory.
<synopsis>
void PGTYPESdecimal_free(decimal *var);
</synopsis>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</sect2>
<sect2 id="ecpg-pgtypes-errno">
<title>errno Values of pgtypeslib</title>
<para>
<variablelist>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-num-bad-numeric">
<term><literal>PGTYPES_NUM_BAD_NUMERIC</literal></term>
<listitem>
<para>
An argument should contain a numeric variable (or point to a numeric
variable) but in fact its in-memory representation was invalid.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-num-overflow">
<term><literal>PGTYPES_NUM_OVERFLOW</literal></term>
<listitem>
<para>
An overflow occurred. Since the numeric type can deal with almost
arbitrary precision, converting a numeric variable into other types
might cause overflow.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-num-underflow">
<term><literal>PGTYPES_NUM_UNDERFLOW</literal></term>
<listitem>
<para>
An underflow occurred. Since the numeric type can deal with almost
arbitrary precision, converting a numeric variable into other types
might cause underflow.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-num-divide-zero">
<term><literal>PGTYPES_NUM_DIVIDE_ZERO</literal></term>
<listitem>
<para>
A division by zero has been attempted.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-date-bad-date">
<term><literal>PGTYPES_DATE_BAD_DATE</literal></term>
<listitem>
<para>
An invalid date string was passed to
the <function>PGTYPESdate_from_asc</function> function.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-pgtypes-errno-pgtypes-date-err-eargs">
<term><literal>PGTYPES_DATE_ERR_EARGS</literal></term>
<listitem>
<para>
Invalid arguments were passed to the
<function>PGTYPESdate_defmt_asc</function>