Subject | RE: [firebird-support] Re: NUMERIC or DECIMAL? |
---|---|

Author | Chad Z. Hower |

Post date | 2004-10-23T13:55:49Z |

:: No, they are extended float that are munged and masked to

:: have a kind of exact precision and scale for display and

:: calculation purposes. I think Geoff talks about it in his

:: article. Delphi/ObjectPascal doesn't have any scaled

Delphi does have a currecny type though that is .xxxx, and there are plenty

of BCD libraries available.

:: numerics. I gather from Chad Hower's message that .NET has

:: a decimal type.

The Decimal value type represents decimal numbers ranging from positive

79,228,162,514,264,337,593,543,950,335 to negative

79,228,162,514,264,337,593,543,950,335. The Decimal value type is

appropriate for financial calculations requiring large numbers of

significant integral and fractional digits and no round-off errors.

A decimal number is a signed, fixed-point value consisting of an integral

part and an optional fractional part. The integral and fractional parts

consist of a series of digits that range from zero to nine (0 to 9),

separated by a decimal point symbol.

The binary representation of an instance of Decimal consists of a 1-bit

sign, a 96-bit integer number, and a scaling factor used to divide the

96-bit integer and specify what portion of it is a decimal fraction. The

scaling factor is implicitly the number 10, raised to an exponent ranging

from 0 to 28.

Therefore, the binary representation of a Decimal value is of the form,

((-296 to 2 96)/ 10 (0 to 28)), where -2 96 is equal to MinValue, and 296 is

equal to MaxValue.

:: have a kind of exact precision and scale for display and

:: calculation purposes. I think Geoff talks about it in his

:: article. Delphi/ObjectPascal doesn't have any scaled

Delphi does have a currecny type though that is .xxxx, and there are plenty

of BCD libraries available.

:: numerics. I gather from Chad Hower's message that .NET has

:: a decimal type.

The Decimal value type represents decimal numbers ranging from positive

79,228,162,514,264,337,593,543,950,335 to negative

79,228,162,514,264,337,593,543,950,335. The Decimal value type is

appropriate for financial calculations requiring large numbers of

significant integral and fractional digits and no round-off errors.

A decimal number is a signed, fixed-point value consisting of an integral

part and an optional fractional part. The integral and fractional parts

consist of a series of digits that range from zero to nine (0 to 9),

separated by a decimal point symbol.

The binary representation of an instance of Decimal consists of a 1-bit

sign, a 96-bit integer number, and a scaling factor used to divide the

96-bit integer and specify what portion of it is a decimal fraction. The

scaling factor is implicitly the number 10, raised to an exponent ranging

from 0 to 28.

Therefore, the binary representation of a Decimal value is of the form,

((-296 to 2 96)/ 10 (0 to 28)), where -2 96 is equal to MinValue, and 296 is

equal to MaxValue.