
Following the bit-level floating-point coding rules, implement the function with the following prototype:
/*
* Compute 1(int) If.
* If conversion causes overflow or f is NaN, return 0x80000000
*/
int float_f21(float_bits f);
For floating-point number f, this function computes (int) f. Your function should round toward zero. If f cannot be represented as an integer (e.g., it is out of range, or it is NaN), then the function should return 0x80000000.
Test your function by evaluating it for all 232 values of argument f and comparing the result to what would be obtained using your machine’s floating-point operations.

Want to see the full answer?
Check out a sample textbook solution
Chapter 2 Solutions
EBK COMPUTER SYSTEMS
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
SURVEY OF OPERATING SYSTEMS
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Concepts Of Programming Languages
- Problem 4 Number of needed subnets 750 Network Address 190.35.0.0 joy worl Subnetting Show your work for Problem Address class B Default subnet mask 255.255.0.0 Custom subnet mask 255.255.255.122 Total number of subnets 1024 Total number of host addresses Number of usable addresses Number of bits borrowed What is the 15th subnet range? What is the subnet number for the 13th subnet? What is the subnet broadcast address for the 10th subnet? What are the assignable addresses for the 6th subnet? 64 65,536 62 32,768 8 10 16,384 512 1,024 2,048 4,096 8,192 16,384 32,768 65,536 256 128 64 32 16 8,192 4,096 2048 1024 512 128 256. 32 16 8 4 2 1 0 0 o O O O O 4 91 8 32 64 +9 821 32 16 8 4 Number of Hosts Number of Subnets Binary values 190. 35 Solve with the right pictures 00 99999arrow_forward5. Task 5: Write a function that takes an array and its size as parameters and returns the sum of its elements(Homework)arrow_forward4.13 Extract a 3×3 array from the upper left-hand corner of the magic square you created in 4.11. Is this also a magic square?arrow_forward
- a If an M/M/1 queue in a server has task arrivals at a rate of 30 per second and serves at a rate of 50 per second, how many tasks are in the system (waiting and being served) on average? b In part (a), how many tasks are being served, on average? c What is the utilization of an M/M/1 queue in a server that has four tasks waiting on average?arrow_forwardEvaluate the average gate capacitance of, and power dissipated by, a processor with the following properties: • Gate oxide thickness = 1.4 nm• Gate length = 65 nm• Gate area = (65 nm)x(65 nm)• Permittivity of free space = 8.85 x 10e−12 Farads/m • Relative permittivity of SiO2 = 3.9 • Rail-to-rail voltage = 1.1 V• Clock frequency = 3.6 GHz• Switching probability = 1.0• Number of transistors per die = 1.3 x 10e9arrow_forwardCan you conver the following C code into ARM Assembly. Assume a is X0 and b is X1if ((a !=0) && (b == 0)) {a++} else {b++}arrow_forward
- Please help. Matlab for engineers 6th edition question.arrow_forwardA certain proram takes 26.67 seconds to run on 3 processors and 16 s to run on 7 processors. Find the execution time on one processor, the fraction of the program that can be parallelized, the theoretical execution time on an infinite number of processors, and P1/2arrow_forwardCan you write the following C code into ARM Assembly. Assume x is X0 and y is X1:switch ( x ) {case 0 : y++; break ;case 1 : y−−; break ;default : break ;}arrow_forward
- Can you write the following C code into ARM Assembly? Assume a is in X0 and b is in X1:while ( a < 10){b=b +10;a++;}arrow_forward# Instructions a. 1.00E+09 b. 1.00E+09 Compiler A Compiler B Execution time #Instructions Execution time 1s 1.20E+09 1.4 s 0.8 s 1.20E+09 0.7 s 1.6.1 [5] For the same program, two different compilers are used. The table above shows the execution time of the two different compiled programs. Find the average CPI for each program given that the processor has a clock cycle time of 1 nS. 1.6.2 15] Assume the average CPIs found in 1.6.1, but that the compiled programs run on two difference processors. If the execution times on the two processors are the same, how much faster is the clock of the processor running compiler A's coce versus the clock of the processor running compiler B's code? 1.6.3 [5] A new compiler is developed that uses only 600 million instruc- tions and has an average CPI of 1.1. What is the speed-up of using this new compiler versus using Compiler A or B on the original processor of 1.6.1? Consider two different implementations, P1 and P2, of the same instruction set.…arrow_forwardExercise 1.4 Consider two different implementations of the same instruction set architecture. There are four classes of instructions, A, B, C, and D. The clock rate and CPI of each implementation are given in the following table. CPI Class B CPI Class C CPI Class D Clock rate CPI Class A P1 1.5 GHz 1 2 3 P2 2 GHz 2 2 2 4 2 1.4.1 [10] Given a program with 10" instructions divided into classes as follows: 10% class A, 20% class B, 50% class C and 20% class D, which implemen- tation is faster? 1.4.2 [5] What is the global CPI for each implementation? 1.4.3 [5] Find the clock cycles required in both cases. The following table shows the number of instructions for a program. Arith 500 Store 50 Load 100 Branch 50 Total 700 1.4.4 [5] Assuming that arith instructions take I cycle, load and store 5 cycles and branch 2 cycles, what is the execution time of the program in a 2 GHz processor? 1.4.5 [5] Find the CPI for the program. 1.4.6 [10] If the number of load instructions can be reduced…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





