Skip to main content
Version: Next

dec

dec ( number : number ) : number

ParameterTypeDescription
numbernumber→Number whose decimal portion is returned
Resultnumber←Decimal part of number

Description​

dec returns the decimal (fractional) portion of number. The value returned is always positive or zero.

Example​

The following example takes a monetary value expressed as a number, and extracts the dollar part and the cents part. If vAmount is 7.31, then vDollars is set to 7 and vCents is set to 31:

 var vDollars, vCents, vAmount : number
vDollars = int(vAmount) //Get the dollars
vCents = dec(vAmount)*100 // Get the fractional part

See also​

int