?
Solved

myDecimal = new decimal(new int[] { 0, 0, 0, 0});

Posted on 2006-03-22
7
Medium Priority
?
225 Views
Last Modified: 2010-04-16
Hi

Anyone know what this code does?

Thanks
Paul

myDecimal = new decimal(new int[] { 0, 0, 0, 0});
0
Comment
Question by:paulwhelan
  • 2
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16258969
in intializes an array of 4 items with each item having the value of 0
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16259013
actually, it creates a decimal with the value of the 4 bytes initalized to 0
0
 

Author Comment

by:paulwhelan
ID: 16259022
Would this not suffice?

myDecimal = new int[] {0,0,0,0};
0
 

Author Comment

by:paulwhelan
ID: 16259397
"actually, it creates a decimal with the value of the 4 bytes initalized to 0"

What does that mean?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 80 total points
ID: 16259528
See the documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdecimalclassctortopic3.asp

The binary representation of a Decimal number consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the integer number 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.

bits is a four-element long array of 32-bit signed integers.

bits [0], bits [1], and bits [2] contain the low, middle, and high 32 bits of the 96-bit integer number.

bits [3] contains the scale factor and sign, and consists of following parts:

Bits 0 to 15, the lower word, are unused and must be zero.

Bits 16 to 23 must contain an exponent between 0 and 28, that indicates the power of 10 to divide the integer number.

Bits 24 to 30 are unused and must be zero.

Bit 31 contains the sign; 0 meaning positive, and 1 meaning negative.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question