From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function NormalizeBcd(const InBCD: TBcd; var OutBcd: TBcd; Precision, Places: Integer): Boolean;


extern DELPHI_PACKAGE bool __fastcall NormalizeBcd(const TBcd &InBCD, TBcd &OutBcd, int Precision, int Places);


Type Visibility Source Unit Parent
function public
Data.FmtBcd Data.FmtBcd


Converts a BCD value into another BCD value with a specified precision and number of decimals.

Call NormalizeBcd to give a TBcd value a specific precision and number of decimal places. If the specified precision or number of decimal places is less than that of the original BCD value, NormalizeBcd truncates the value (as opposed to rounding).

InBcd is the BCD value to convert.

OutBcd returns the resulting BCD value with the specified precision and decimal places.

Precision is the number of significant digits in OutBcd.

Places is the number of decimal places in OutBcd.

NormalizeBcd returns true if the conversion can be made with no loss of precision. It returns false if the conversion requires some digits to be truncated.

Note that in releases prior to XE2, the parameter names were Prec and Scale.

See Also