Home Explore Blog CI



postgresql

95th chunk of `doc/src/sgml/ecpg.sgml`
739533db6696a9c201297bf40a649b24585c759b349a3e6f0000000100000fa6

</synopsis>
        The function receives a pointer to the first decimal value
        (<literal>arg1</literal>), a pointer to the second decimal value
        (<literal>arg2</literal>) and returns an integer value that indicates which is
        the bigger value.
        <itemizedlist>
         <listitem>
          <para>
           1, if the value that <literal>arg1</literal> points to is bigger than the
           value that <literal>var2</literal> points to
          </para>
         </listitem>
         <listitem>
          <para>
           -1, if the value that <literal>arg1</literal> points to is smaller than the
           value that <literal>arg2</literal> points to </para>
         </listitem>
         <listitem>
          <para>
           0, if the value that <literal>arg1</literal> points to and the value that
           <literal>arg2</literal> points to are equal
          </para>
         </listitem>
        </itemizedlist>
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-deccopy">
      <term><function>deccopy</function></term>
      <listitem>
       <para>
        Copy a decimal value.
<synopsis>
void deccopy(decimal *src, decimal *target);
</synopsis>
        The function receives a pointer to the decimal value that should be
        copied as the first argument (<literal>src</literal>) and a pointer to the
        target structure of type decimal (<literal>target</literal>) as the second
        argument.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-deccvasc">
      <term><function>deccvasc</function></term>
      <listitem>
       <para>
        Convert a value from its ASCII representation into a decimal type.
<synopsis>
int deccvasc(char *cp, int len, decimal *np);
</synopsis>
        The function receives a pointer to string that contains the string
        representation of the number to be converted (<literal>cp</literal>) as well
        as its length <literal>len</literal>. <literal>np</literal> is a pointer to the
        decimal value that saves the result of the operation.
       </para>
       <para>
        Valid formats are for example:
         <literal>-2</literal>,
         <literal>.794</literal>,
         <literal>+3.44</literal>,
         <literal>592.49E07</literal> or
         <literal>-32.84e-4</literal>.
       </para>
       <para>
        The function returns 0 on success. If overflow or underflow occurred,
        <literal>ECPG_INFORMIX_NUM_OVERFLOW</literal> or
        <literal>ECPG_INFORMIX_NUM_UNDERFLOW</literal> is returned. If the ASCII
        representation could not be parsed,
        <literal>ECPG_INFORMIX_BAD_NUMERIC</literal> is returned or
        <literal>ECPG_INFORMIX_BAD_EXPONENT</literal> if this problem occurred while
        parsing the exponent.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-deccvdbl">
      <term><function>deccvdbl</function></term>
      <listitem>
       <para>
        Convert a value of type double to a value of type decimal.
<synopsis>
int deccvdbl(double dbl, decimal *np);
</synopsis>
        The function receives the variable of type double that should be
        converted as its first argument (<literal>dbl</literal>). As the second
        argument (<literal>np</literal>), the function receives a pointer to the
        decimal variable that should hold the result of the operation.
       </para>
       <para>
        The function returns 0 on success and a negative value if the
        conversion failed.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-deccvint">
      <term><function>deccvint</function></term>
      <listitem>
       <para>
        Convert a value of type int to a value of type decimal.
<synopsis>
int deccvint(int in, decimal *np);
</synopsis>
        The function receives the variable of type int that should

Title: Additional Informix-Compatible Decimal Functions (deccopy, deccvasc, deccvdbl, deccvint)
Summary
This section details additional functions for working with decimal types in an Informix-compatible manner. It describes `deccopy` (copying a decimal value), `deccvasc` (converting from ASCII representation to decimal), `deccvdbl` (converting from double to decimal), and `deccvint` (converting from integer to decimal), including their synopsis, parameters, and return values.