New Method for LCNumeric

This is the constructor method for the new LCNumeric class object.

Defined In

LCNumeric

Syntax

Dim variableName As New LCNumeric(lprecision, scale)

Parameters

Parameter

Description

precision

Long. Optional. Precision for this object, from 0 - 88. Default is LCMAX_NUMERIC_PREC (88). This is the total number of decimal digits you can store in the object.

scale

Long. Optional. Scale for this object, from -127 to +127. Default if both arguments are omitted is LCMAX_NUMERIC_PREC / 2 (44). If a precision is specified, the default scale is zero.

This number specifies the position of the decimal point relative to the last digit. Zero specifies an integer value. The 1 setting specifies a value with one digit following the decimal point. The -1 setting specifies a value with a decimal point one place following the final digit stored (an integer multiple of 10).

Regardless of the precision, scale can be any number in the -127 to 127 range.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
	Dim hundreds As New LCNumeric(8, -2)
	Dim tens As New LCNumeric(8, -1)
	Dim ints As New LCNnumeric(8, 0)
	Dim defaultNum As New LCNumeric
	hundreds.Value = 4567.89
	tens.Value = 4567.89
	ints.Value = 4567.89
	defaultNum.Value = 4567.89
	Print "hundreds=" & hundreds.Text & ", tens=" & tens.Text & ", ints=" & ints.Text & ", defaultNum=" & defaultNum.Text
End Sub

Example Output

hundreds=4500, tens=4560, ints=4567, defaultNum=4567.89