The decimal library functions
You must perform all operations on decimal type
numbers through the following library
functions for the decimal data type. Any other operations,
modifications, or analyses can produce unpredictable results.
Function name | Description | See |
---|---|---|
decadd() | Adds two decimal numbers | The decadd() function |
deccmp() | Compares two decimal numbers | The deccmp() function |
deccopy() | Copies a decimal number | The deccopy() function |
decdiv() | Divides two decimal numbers | The decdiv() function |
decmul() | Multiplies two decimal numbers | The decmul() function |
decround() | Rounds a decimal number | The decround() function |
decsub() | Subtracts two decimal numbers | The decsub() function |
dectrunc() | Truncates a decimal number | The dectrunc() function |
Function name | Description | See |
---|---|---|
deccvasc() | Converts a C char type value to a decimal type value | The deccvasc() function |
deccvdbl() | Converts a C double type value to a decimal type value | The deccvdbl() function |
deccvint() | Converts a C int type value to a decimal type value | The deccvint() function |
deccvlong() | Converts a C 4-byte integer type value to a decimal type value | The deccvlong() function |
dececvt() | Converts a decimal value to an ASCII string | The dececvt() and decfcvt() functions |
decfcvt() | Converts a decimal value to an ASCII string | The dececvt() and decfcvt() functions |
dectoasc() | Converts a decimal type value to an ASCII string | The dectoasc() function |
dectodbl() | Converts a decimal type value to a C double type value | The dectodbl() function |
dectoint() | Converts a decimal type value to a C int type value | The dectoint() function |
dectolong() | Converts a decimal type value to a C 4-byte integer type value | The dectolong() function |
For information about the function rfmtdec(), which allows you to format a decimal number, see Numeric-formatting functions. For additional information about decimal values, see Operations that involve a decimal value