{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Tema3 - CHAPTER 3 3.1 Here is a VBA implementation of the...

This preview shows pages 1–3. Sign up to view the full content.

CHAPTER 3 3.1 Here is a VBA implementation of the algorithm: Option Explicit Sub GetEps() Dim epsilon As Single epsilon = 1 Do If epsilon + 1 <= 1 Then Exit Do epsilon = epsilon / 2 Loop epsilon = 2 * epsilon MsgBox epsilon End Sub It yields a result of 1.19209 × 10 - 7 on my desktop PC. 3.2 Here is a VBA implementation of the algorithm: Option Explicit Sub GetMin() Dim x As Single, xmin As Single x = 1 Do If x <= 0 Then Exit Do xmin = x x = x / 2 Loop MsgBox xmin End Sub It yields a result of 1.4013 × 10 - 45 on my desktop PC. 3.3 The maximum negative value of the exponent for a computer that uses e bits to store the exponent is ) 1 2 ( 1 min - - = - e e Because of normalization, the minimum mantissa is 1/b = 2 - 1 = 0.5. Therefore, the minimum number is 1 1 2 ) 1 2 ( 1 min 2 2 2 - - - - - - = = e e x For example, for an 8-bit exponent 39 128 2 min 10 939 . 2 2 2 1 8 - - - × = = = - x This result contradicts the value from Prob. 3.2 (1.4013 × 10 - 45 ). This amounts to an additional 21 divisions (i.e., 21 orders of magnitude lower in base 2). I do not know the reason for the discrepancy. However, the problem illustrates the value of determining such quantities via a program rather than relying on theoretical values.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3.4 VBA Program to compute in ascending order
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

Tema3 - CHAPTER 3 3.1 Here is a VBA implementation of the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online