Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2.89 (Chapter 2): (Book: Computer Systems: A Programmers Perspective (Third edition) ) We are running programs on a machine where values of type int

Question 2.89 (Chapter 2): (Book: Computer Systems: A Programmers Perspective (Third edition))

We are running programs on a machine where values of type int have a 32 bit two's-complement representation. Values of the type float use the 32 bit IEEE format, and values of type double use the 64 bit IEEE format.

We generate arbitrary integer values x, y, and z, and convert them to values of type doubles as follows:

/* Create some arbitrary values */

int x = random();

int y = random();

int z = random();

/* Convert to double */

double dx = (double) x;

double dx = (double) y;

double dx = (double) z;

For each of the following C expressions, you are to indicate whether or not the expression always yields 1. If it always yields 1, describe the underlying mathematical principles. Otherwise give an example of arguments that make it yield 0. Note that you cannot use an IA32 machine running GCC to test your answers, since it would use 80 bit extended precision representation for both float and double.

A. (float) x == (float) dx

B. dx - dy == (double) (x-y)

C. (dx + dy) + dz == dx * (dy + dz)

D. (dx * dy) * dz == dx * (dy * dz)

E. dx / dx == dz / dz

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions