Minggu, 02 September 2018

Sistem Digital : Sistem Bilangan Iii ( Representasi Floating-Point Dengan Single Precision )

Sistem Digital : Sistem Bilangan III ( Representasi Floating-Point dengan Single Precision )



Floating-Point Representation

Principles

With a fixed-point notation it is possible to represent a range of positive and negative integers centered on or near 0. By assuming a fixed binary or radix point, this format allows the representation of numbers with a fractional component as well

Limitations :
  • Very large numbers cannot be represented nor can very small fractions
  • The fractional part of the quotient in a division of two large numbers could be lost

Typical 32-Bit Floating-Point Format



Floating-Point

The selesai portion of the word. Any floating-point number can be expressed in many ways


Normal number

The most significant digit of the significand is nonzero

Untuk lebih sederhana operasi bilangan floating point perlu di normalkan. Bilangan normal ialah dimana MSB dari significand ialah nonzero. Untuk representasi binary, normal number ialah MSB dari significand ialah 1. 

Berikut bentuk normal nonzero number


Dimana b ialah digit biner ( 0 atau 1)

MSB selalu 1, sebab itu tidak perlu disimpan (secara implisit). Makara secara implisit, 23 bit untuk menyimpan 24 bit significand. Sehingga nilainya berada di antara dan sama dengan 1 s/d < 2.

Contoh bentuk yang dinormalkan



Format 32-bit floating point


Sign disimpan pada bit pertama (dari 32 bit). Bit pertama dari significand ialah 1 dan tidak perlu disimpan pada field. Nilai 127 ditambahkan pada true exponent untuk disimpan di field exponent – disebut biased exponent representation 

Base ialah 2 
E = exponent 
S = Significand


Contoh

Binary 1011010010001 
Dibentuk normal 1.011010010001 * 212 
Format 32 bit 
Sign = 0 (positif) 
Biased = 12 + 127 = 10001011 
Significand/Mantissa (Fractional) = 011010010001 

Bentuk floating pointnya dalam format 32




Floating Point 32 bit ke Decimal

1 10010001 10001110001000000000000 

Sign = 1 ( negative )
Exponent = 10010001 => 145 
Bilangan = (-1)1 (1.10001110001)(2145-127) = -1100011100010000000 = 407680 (decimal)



Latihan

1. Konversi bilangan decimal 3,248 x 104 ke single-precision floating-point binary?

2. Tentukan nilai binary dan decimal dari bilangan binary floating-point berikut :

0 10011000 10000100010100110000000


Expressible Numbers of Floating-point



Produce one of these conditions

Exponent overflow : A positive exponent exceeds the maximum possible exponent value. In some systems, this may be designated as +∞ or - ∞.

Exponent underflow : A negative exponent is less than the minimum possible exponent value (e.g., - 200 is less than -127) 

Significand underflow : In the process of aligning significands, digits may flow off the right end of the significand. As we will discuss, some form of rounding is required.

Significand overflow : The addition of two significands of the same sign may result in a carry out of the most significant bit. This can be fixed by realignment.


IEEE 754 Formats



Arithmetic Operations



Addition and Subtraction



Ada 4 fase dari algoritma untuk penambahan dan pengurangan 

Phase 1. Zero check : Because addition and subtraction are identical except for a sign change, the process begins by changing the sign of the subtrahend if it is a subtract operation. Next, if either operand is 0, the other is reported as the result.

Phase 2. Significand alignment : The next phase is to manipulate the numbers so that the two exponents are equal.

Phase 3. Addition : Next, the two significands are added together, taking into account their signs. Because the signs may differ, the result may be 0. There is also the possibility of significand overflow by 1 digit. If so, the significand of the result is shifted right and the exponent is incremented. An exponent overflow could occur as a result; this would be reported and the operation halted.

Phase 4. Normalization : The selesai phase normalizes the result. Normalization consists of shifting significand digits left until the most significant digit (bit, or 4 bits for base-16 exponent) is nonzero. Each shift causes a decrement of the exponent and thus could cause an exponent underflow. Finally, the result must be rounded off and then reported.

Floating-Point Addition and Subtraction Flowchart



Floating-Point Multiplication Flowchart



Floating-Point Division Flowchart


Sumber


Slide AOK : Representasi Bilangan Biner

Sumber http://wikiwoh.blogspot.com


EmoticonEmoticon