The deccvasc() function

The deccvasc() function converts a value held as printable characters in a C char type into a decimal type number.

Syntax

mint deccvasc(strng_val, len, dec_val)
   char *strng_val;
   mint len;
   dec_t *dec_val;
strng_val
A pointer to the string value to convert to a decimal value.
len
The length of the strng_val string.
dec_val
A pointer to a decimal structure to contain the result of the conversion.

Usage

The character string, strng_val, can contain the following symbols:
  • A leading sign, either a plus (+) or minus (-)
  • A decimal point, and digits to the right of the decimal point
  • An exponent that is preceded by either e or E. You can precede the exponent by a sign, either a plus (+) or minus (-).

The deccvasc() function ignores leading spaces in the character string.

Return values

0
The conversion was successful.
-1200
The number is too large to fit into a decimal type structure (overflow).
-1201
The number is too small to fit into a decimal type structure (underflow).
-1213
The string has non-numeric characters.
-1216
The string has a bad exponent.