Question: Part II. Write a program that evaluates the following function for various inputs. f(x) = x(Vx + 1 - Vr) 1. Create a C++ program

Part II. Write a program that evaluates the following function for various inputs. f(x) = x(Vx + 1 - Vr) 1. Create a C++ program called YourLastName2.cpp. 2. Convert f (x) into an equivalent function that does not contain a subtraction and call it f2(x). 3. Evaluate f (x) and f2(x) using 1) single precision and 2) double precision for x = 1, 10, 10, ... 108, 109. Hint: Declare C++ variables as float and double for the single and double precisions, respectively. 4. Your program should display output similar to the following with single precision. f(x) f2 (x) 1 0.414213538169861 0.414213538169861 10 1.543471813201904 1.543471217155457 100 4.987525939941406 4.9875621795 65430 1000 15.808105468750000 15.807437896728516 10000 49.972534179687500 49.998748779296875 100000 158.691406250000000 158.113494873046875 1000000 488.281250000000000 499.999877929687500 10000000 2441.406250000000000 1581.138793945312500 100000000 0.000000000000000 5000.000000000000000 1000000000 0.000000000000000 15811.387695312500000 PX 5. Your program should display output similar to the above with double precision
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
