Following the bit-level floating-point coding rules, implement the function with the following prototype:
/* Compute 0.5*f. If f is NaN, then return f. */
float_bits float_half(float_bits f);
For floating-point number f, this function computes 0.5 f. If f is NaN, your function should simply return f.
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 solutionChapter 2 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Additional Engineering Textbook Solutions
Using MIS (10th Edition)
Starting out with Visual C# (4th Edition)
Digital Fundamentals (11th Edition)
Software Engineering (10th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Modern Database Management (12th Edition)
- Q11/ A function f(t) is said to be even if: Oa) f(t) = f(-t) Ob) f(t) = -f(-t) Oc) f(t) # f(-t) %3D Od) None of thesearrow_forwardF = A +B'C which one of the followings is the representation of function F in terms of SOP form? F(A,B,C)= m0+m2+m3 F(A,B,C)= M0+M2+M3 F(A,B,C) = M1+M4+M5+M6+M7 F(A,B,C) = m1+m4+m5+m6+m7arrow_forwardWrite a function int Factorial(int n) to calculate factorial of n. If n is non negative then it return factorial, otherwise it display a proper error message and return -1.arrow_forward
- Given a Binary Number B, find its decimal equivalent. Example 1: Input: B = 10001000 Output: 136 Example 2: Input: B = 101100 Output: 44 Your Task: You don't need to read or print anything. Your task is to complete the function binary_to_decimal() which takes the binary number as string input parameter and returns its decimal equivalent. Expected Time Complexity: 0(K* Log(K)) where K is number of bits in binary number. Expected Space Complexity: 0(1)arrow_forwardQuestion VI: Write a program that computes and plots the spectral representation of the function 1. y(t) = (10e-10t)u(t) 2. y(t) = (10e-10t cos100t)u(t)arrow_forward* نقطتان (2) Which code would you use to find the value of the function f? f(x)=sin(x) + cos (x) + tan (x) at x = π/4 sin(45)+cos(45)+tan(45) O sin(45®)+cos(45®)+sin(45®) O sin(pi/4)+cos(pi/2)+tan(pi/4) sind (45)+cosd(45)+tand (45) sin(pi/4)+cos(pi/4)+tan(pi/4) Oarrow_forward
- ****************************** ********** Q4} For the following function f(x)=Sin(x) - Cos(x)+x. Write the mat lab commands to: 1.Draw the function in [-II, II]. 2.Find the zeros of this function. 3. Find the minimum value of function. 4. Find f(1/2) 5.integration the function.arrow_forwardF(x.y,z)=x'y'z+x'yz+xy'z'+xy'z can you simplify this and draw the diagram of the simplified functionarrow_forwardIf you implement the function F(A,B,C,D)= Sum m (3,4,6,11,12,13,14) using a 8-1 MUX then which of the input position will be equal to D : a. I1 & I6 b. only I5 c. I2 & I6 & I7 d. Only I7 e. None of the choices f. I1 & I5arrow_forward
- Question 1 - Write a function to reverse the bits in a byte. /// Reverses the bits in a byte /// @param x- the input byte /// @return the same byte with the bits reversed uint8_t reverse_bits (uint8_t x) {arrow_forwardWhat is the reduced form of the function F X(XY)+X(X+Y)? a) Y b) X c) 0 d) 1arrow_forwardComplete the function calculate, which computes and returns the value of the following sum for the given arguments, x and n. n Σ ( ² × ²¹) - ( ² × ²¹) + ( ² × ²²) + ( ³×²³) + - + (² × ²ª¹) 2n = X2³ i=1 Assume n ≥ 1. Examples: Function Call calculate (5,4) calculate (2,7) calculate (7,2) 0.6122448979591837 calculate (3,9) 22.196311537875324 Return Value 23 2.0256000000000003 140.0 [ ] 1 def calculate (x, n): return 0 # DELETE THIS LINE and start coding here. # Remember: end all of your functions with a return statement, not a print statement! 4 5 # Test cases 6 print (calculate (5, 4)) 7 print (calculate (2, 7)) 8 print (calculate (7, 2)) 9 print (calculate (3, 9))arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education