# Write a C program to show that, in floating-point arithmetic, the result of (A+B)-B may not always..

Write a C program to show that, in floating-point arithmetic, the result of (A+B)-B may not always..
Write a C program to show that, in floating-point arithmetic, the result of (A+B)-B may not always be equal to A. That is, after the following operations, D may not be equal to A. C A+B D C-B 1. First, run your code and show that D is equal to A.
2. Then, run your code with different A and B values and show that D is not equal to A. The numbers you select for A and B must be correctly represented in 32-bit binary form. For example: (0.6875)10 can be exactly represented in 32-bit floating format since = 1 * 2-1 + 1 * 2-3 + 1 * 2-4 = 0.5 + 0.125 + 0.0625 = 0.6875 Hence, its 32-bit floating point representation would be 00111111 00110000 00000000 00000000 However, (1.36)10 cannot be exactly represented in 32-bit floating format since the fractional part 0.36 cannot be exactly obtained by the sum of the weights 2-1 , 2-2 , 2-3 , etc. Hence, its 32-bit floating point representation would be 00111111 10101110 00010100 01111011 Therefore, you must select numbers for A and B such that their fractional parts can be exactly represented in 32- bit floating format, as in the number (0.6875)10. The following code may help you to find the desired numbers: #include #include #include int main(){
float a; for(;;){ printf(“nnENTER the value of a:n”); scanf(“%f”, &a); union ieee754_float *p_a; unsigned int a_exp; unsigned int a_negative; unsigned int a_mantissa; p_a = (union ieee754_float*)&a; a_exp = p_a->ieee.exponent; a_negative = p_a->ieee.negative; a_mantissa = p_a->ieee.mantissa; printf(“exponent of a: %xn”, a_exp); printf(“negative of a: %xn”, a_negative); printf(“mantissa of a: %xn”, a_mantissa); } return 0; } You can use online c compiler for compiling your code: https://www.onlinegdb.com/online_c_compiler         May 13 2022 07:29 PM

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.