Re: Decimal Data Type bit layout
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sat, 10 Sep 2005 07:03:45 +0100
mdavidjohnson <mdj@xxxxxxxxxxxxx> wrote:
> What is the actual bit layout of the decimal data type?
>
> i.e.; if the double data type layout is sign = 1 bit, biased exponent = 11
> bits, and mantissa = 52 bits; what is the corresponding description for
> decimal?
>
> I read that a decimal includes a 1-bit sign, a 96-bit integer number, and an
> exponent that ranges from 0 to 28 (which would require 5 bits). The total
> would thus be 102 bits which would fit in 13 bytes with two bits left over.
> Seems strange.
That's exactly the layout - if you look at the docs for Decimal, it's
documented there.
I suspect the reason it doesn't go any further is that it's a lot
easier (and quicker) to manipulate three ints as the mantissa than
"three and a bit" ints. I suspect there aren't many applications for
which 28 digits is insufficient, but a couple more digits would be
okay.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Decimal Data Type bit layout
- From: mdavidjohnson
- Re: Decimal Data Type bit layout
- From: mdavidjohnson
- Re: Decimal Data Type bit layout
- References:
- Decimal Data Type bit layout
- From: mdavidjohnson
- Decimal Data Type bit layout
- Prev by Date: RE: Decimal Data Type bit layout
- Next by Date: Re: Decimal Data Type bit layout
- Previous by thread: RE: Decimal Data Type bit layout
- Next by thread: Re: Decimal Data Type bit layout
- Index(es):
Relevant Pages
|