Demonstrate the Limitations in Precision of Floating Point Numbers (8 points) For this assignment, you will use a programming language of your choice to demonstrate how a lack of precision in floating point numbers can lead to incorrect results. Do the following: • Determine two sequences of floating point mathematical operations that should yield the same result (e.g., 1.0 + 1.0 = 2.0 and 3.0 – 1.0 = 2.0). • In a programming language of your choice, perform those operations and store the results in two variables. • Check the variables for equivalence. If the computer determines they are equal, repeat the process with different (more complex) sequences of operations until you have two variables that should be equal in value, but the computer determines that they are not due to truncation or round-off. Submit a Word document with screenshots of your code and running program showing the results. Format your submission according to the APA style guide. Remember that all work should be your own original work and assistance received from any source and any references used must be authorized and properly documented Purchase the answer to view it

The limitations in precision of floating point numbers arise from the fact that they can only represent a finite number of digits. This means that when performing mathematical operations with floating point numbers, there is a possibility of error due to truncation or round-off.

To demonstrate these limitations, we can consider two sequences of floating point mathematical operations that should yield the same result. For example, let’s consider the sequences: 1.0 + 1.0 and 3.0 – 1.0. These should both equal to 2.0.

To perform these operations and store the results in variables, we will use a programming language of our choice. Let’s say we use Python for this assignment. Here is an example code snippet that demonstrates these operations:

“`python
# Perform the first sequence of operations: 1.0 + 1.0
result1 = 1.0 + 1.0

# Perform the second sequence of operations: 3.0 – 1.0
result2 = 3.0 – 1.0
“`

Next, we need to check the variables for equivalence. We will use the computer to determine if they are equal. If they are not, we will repeat the process with more complex sequences of operations until we find two variables that should be equal in value but are not due to truncation or round-off errors. Here is an example code snippet that checks for equivalence:

“`python
# Check if the variables are equal
if result1 == result2:
print(“The variables are equal.”)
else:
print(“The variables are not equal.”)
“`

If the variables are found to be equal, we can conclude that there is no error due to truncation or round-off. However, if the variables are determined to be not equal, it indicates a limitation in the precision of floating point numbers.

In order to provide screenshots of the code and running program, a Word document can be created with the code snippets and their output. The document should be formatted according to the APA style guide, including proper citations and references for any assistance received or references used. It is important to ensure that all work is original and properly documented.

In conclusion, the assignment asks us to demonstrate the limitations in precision of floating point numbers by performing mathematical operations and comparing the results. This can be done using a programming language of our choice, such as Python, and documenting the process in a Word document following APA style guidelines.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer