Tutorial Addendum On C# - Allotment B - Bifold Representation of float and bifold Ethics

ios appcolt wargamesios strategygamesios
 31 December 18:00   

    



    



    

In adjustment to acknowledgment some of the questions aloft in the antecedent sections,

    

let s yield a abutting attending at how absolute numbers are represented in a computer system.

    

In C#, the IEEE 754 single-precision and double-precision standards are used

    

to represent "float" and "double" blazon ethics respectively. We will altercate the

    

storage representation of "decimal" after in this book.

    



    

Since the IEEE 754 standards are broadly acclimated in the computer industry,

    

there are a lots of publications accessible talking about these standards.

    

In this section, I will explain alone some basal rules of the standards.

    



    

Rule 1: The bifold representation is disconnected into 3 apparatus

    

with altered amount of $.25 assigned to anniversary compoents:

    



    

Assurance Backer Atom Total

    

Single-Precision 1 8 23 32

    

Double-Precision 1 11 52 64

    



    



    

Since the aberration amid the single-precision and double-precision is only

    

the amount of $.25 acclimated in the backer and atom components, we will alone use

    

the single-precision in the altercation from now on.

    



    

Rule 2: The individual bit in the assurance basic represents a assurance amount (s)

    

through the bifold assurance convention:

    



    

Assurance (s)

    

Bit Arrangement Value

    

0 1

    

1 -1

    



    



    

Rule 3: The 8-bit aggregate in the expoenent basic represents

    

an backer amount (e) through the bifold basic amount convention:

    



    

Backer (e)

    

Bit Arrangement Amount

    

00000001 1 <-- 2^0

    

00000010 2 <-- 2^1

    

00000011 3 <-- 2^1 + 2^0

    

... ...

    

11111110 254

    



    



    

Note that the bit patterns of all 0s and all 1s are not account here, because

    

then are aloof for appropriate purposes, which will be discussed later.

    



    

Rule 4: The 23-bit aggregate in the atom basic represents

    

a atom amount through the bifold apportioned amount convention:

    



    

Atom (f)

    

Bit Arrangement Value

    

0000000 00000000 00000000 .0

    

1000000 00000000 00000000 .5 <-- 2^(-1)

    

0100000 00000000 00000000 .25 <-- 2^(-2)

    

1100000 00000000 00000000 .75 <-- 2^(-1) + 2^(-2)

    

... ...

    

1111111 11111111 11111111 .?

    



    



    

Rule 5: Putting all 3 apparatus together, the single-precision 32-bit pattern

    

represents a absolute amount (r) through the afterward expression:

    



    

r = s * 1.f * 2^(e-127)

    



    



    

Note that a numbers bidding in this anatomy of announcement is alleged a normalized number,

    

because its bifold point has been normalized to appropriate afterwards the arch 1. Aswell note

    

that the arch 1 is not stord any where.

    



    

Now let s attending at the ambit of absolute normalized numbers:

    



    

s e f r

    

0 00000001 0000000 00000000 00000000 1 1 .0 --> 1 * 1.0 * 2^(1-127)

    

0 00000001 1000000 00000000 00000000 1 1 .5 --> 1 * 1.5 * 2^(1-127)

    

...

    

0 01111111 0000000 00000000 00000000 1 127 .0 --> 1 * 1.0 * 2^(127-127)

    

0 01111111 1000000 00000000 00000000 1 127 .5 --> 1 * 1.5 * 2^(127-127)

    

...

    

0 11111110 0000000 00000000 00000000 1 254 .0 --> 1 * 1.0 * 2^(254-127)

    

0 11111110 1000000 00000000 00000000 1 254 .0 --> 1 * 1.5 * 2^(254-127)

    

...

    

0 11111110 1111111 11111111 11111111 1 254 .? --> 1 * 1.? * 2^(254-127)

    



    



    

Rule 6: If the backer basic abundance all 0s, the 3 apparatus are

    

put calm to represent a denormalized amount through the afterward expression:

    



    

r = s * 0.f * 2^(1-127)

    



    



    

This announcement is advised to extend the ambit of the normalized numbers a little

    

bit on the 0 side:

    



    

s e f r

    

0 00000000 0000000 00000000 00000000 1 0 .0 --> 1 * 0.0 * 2^(1-127)

    

0 00000000 1000000 00000000 00000000 1 0 .5 --> 1 * 0.5 * 2^(1-127)

    

...

    

0 00000000 1111111 11111111 11111111 1 0 .? --> 1 * 0.? * 2^(1-127)

    



    

 


Tags: numbers, value, standards, float, values, single, convention

 precision, binary, value, fraction, double, single, exponent, normalized, expression, component, standards, components, representation, numbers, float, convention, values, pattern, , 00000000 00000000, 1000000 00000000, 0000000 00000000, single precision, 11111111 11111111, 254 127, 1111111 11111111, float and, binary representation, bit pattern, pattern value, 1000000 00000000 00000000, 0000000 00000000 00000000, 1111111 11111111 11111111, bit pattern value,

Share Tutorial Addendum On C# - Allotment B - Bifold Representation of float and bifold Ethics:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  c-sharp