We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

on
Medium Priority
290 Views
Hi

Anyone know what this code does?

Thanks
Paul

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

## View Solution Only

Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
in intializes an array of 4 items with each item having the value of 0
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
actually, it creates a decimal with the value of the 4 bytes initalized to 0

Commented:
Would this not suffice?

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

Commented:
"actually, it creates a decimal with the value of the 4 bytes initalized to 0"

What does that mean?
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
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.

Not the solution you were looking for? Getting a personalized solution is easy.

##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile

OR

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the