Question: Assume variables x, f, and d are of type int, float, and double, respectively. Their values are arbitrary, except that neither f nor d equals

Assume variables x, f, and d are of type int, float, and double, respectively. Their values are arbitrary, except that neither f nor d equals +∞, −∞, or NaN. For each of the following C expressions, either argue that it will always be true (i.e., evaluate to 1) or give a value for the variables such that it is not true (i.e., evaluates to 0).

A. x == (int) (double) x B. x == (int) (float) x C. d (double) (float) d D. f (float) (double) f == E. f

A. x == (int) (double) x B. x == (int) (float) x C. d (double) (float) d D. f (float) (double) f == E. f ==-(-f) F. 1.0/2 1/2.0 G. d d >= 0.0 H. (f+d)-f == d ==

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Exercises such as this one help you develop your ability to reason about floating point op... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!