Carapace

Decimal Class

When using ActiveX Data Objects to access databases, one of the supported data-types for columns is a decimal. This can hold integers as well as floating point numbers to a precision greater than that offered by the Integer or Real Carapace types.

Decimal Creation

The create function can be used to create a Decimal object. The following three statements all create decimals:

    (create Decimal 33.3)
    (create Decimal "33.3")
    (create Decimal 33)
More commonly, a Decimal is returned by selecting data from a database where the column type is decimal.

Decimal Properties

None.

Decimal Methods

The Decimal object supports the following methods:

method name description
string return a string representation of the decimal
integer convert the decimal to an Integer -- since an Integer cannot hold the same precision as a decimal, this conversion may fail
real convert the decimal to a Real -- since an Real cannot hold the same precision as a decimal, information may be lost
fill fill the decimal from the supplied data


string

Return a string representation of the decimal.

Arguments: none

Return type: String


integer

Convert the decimal to an Integer -- since an Integer cannot hold the same precision as a decimal, this conversion may fail.

Arguments: none

Return type: Integer


real

Convert the decimal to a Real -- since an Real cannot hold the same precision as a decimal, information may be lost.

Arguments: none

Return type: Real


fill

Fill the decimal from the supplied data. The data can be supplied as a String, Integer or Real

Arguments:

dataObject

Return type: the empty List () is returned.


Contents Index Current topic: objects Related topics: functions