Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON What we think of as real numbers in an algorithm, we approximate for computing purposes as floating-point numbers of the form: (-1)S (do d1d2...

PYTHONimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

What we think of as real numbers in an algorithm, we approximate for computing purposes as floating-point numbers of the form: (-1)S (do d1d2... dp-1 Be where s E 0,1 indicates the sign p is the number of digits or precision each digit di [0, 1,...,B - 1] B is the base and e is the exponent. While we, as humans, tend toward base B = 10 , computers almost universally use a binary representation with B= 2. The floating-point representation corresponds to a unique real number: x = (-1)$(do + 8 + ... B + 4 "Alpe Some real numbers have an exact (but not unique) floating-point representation; e.g. x = 0.5 has the following representations: * = (-1)0 (1.0) 2-1=(-1)0(1 + ) 2-1= and i =(-1) (0.1) 2 = (-1 For uniqueness, choose the normalized (first) version with do + 0. A floating point number system is defined by base B, precision (number of digits) p, and range of exponents [eminemax. . Let's take a look at an example: B = 2, p = 2, e (-2,3] Positive normalized numbers: x = (-1)(1.0) 2-2 = 1 = (-1) (1.1) 2-2 1 # =(-1)(1.0) 2-1= 1 * =(-1) (1.1) 2-1= 3 x = (-1) (1.0) 20 = 1 * =(-1) (1.1) 20 = # =(-1) (1.0) 2+ = 2 =(-1) (1.1) 21 x= (-1)^(1.0) 22 = 4 x = (-10 (1.1) 22 = 6 = (-1) (1.0) 23 = 8 = (-1) (1.1) 23 = 12 xe X = {{1/4, 3/8, 1/2, 3/4, 1, 3/2, 2, 3, 4, 6, 8, 12} Here we embellish slightly by adding 1 digit of precision to get: = 2, p = 3, e -1,0,1,2,3 2a) Write a function (by completing the template below) to compute the number of entries in the array of all normalized representable values in a floating point system. Remember that the first digit in a normalized number must be non-zero. The other digits are integers satisfying 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

Explain the human resource planning process.

Answered: 1 week ago

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

4. Who would lead the group?

Answered: 1 week ago