# CFM Assignment 1.pdf - Chase Heafner Assignment 1...

• Homework Help
• 13

This preview shows page 1 - 3 out of 13 pages.

Chase HeafnerAssignment 1Computational FinanceProgramming Assignment I. Executive Summary Floating point precision was observed for its use on a machine. A reusable program was developed that can define the variable FMFloat (floating point number) at compile time as either type float or type double (single-precision or double-precision). The variable FMFloat can then be declared later in the code and given values. The program also has functions that can return the machine epsilon, largest positive floating point number, and smallest positive floating point number which in return match the values provided byfloat.h. Finally, the program displays examples of stability and conditioning. II. Statement of the Problem 1.1.a.Develop a way to change FMFloat type at compile time and then compare the returned function results to what we’ve learned in class about IEEE floating point precision. 1.2.b.Ensure the code works idealy for both single and double-precisions selections. Also, provide examples of stability and conditioning within the code. III. Description of the Mathematics 1.1.a.We know for floating point representation in IEEE format we have a 32-bit number in single precision and a 64-bit number in double precision. One bit is used in both types of precsion for the sign of the mantissa, σ. In single-precision, 23(+1) bits are used for the normalized mantissa, μ, while 52(+1) bits are used in double-precision. Then in single-precision 8 bits are used for the exponent, εwhile 11 bits are used in double-precision. Finally, the floating point representation in IEEE can be symbolized as (-1)σμ ×2ε- 127, (1 ε254), for single-precision, and (-1)σμ ×2ε- 1023, (1 ε2046), for double-precision. 1.1.b.Conditioning is a way of analyzing a problem as it is represented on a machine. problem is well-conditioned if the observed difference between the true solution of the problem and the exact solution of a slightly perturbed problem is small. If there is a large difference, we then say the problem is ill-conditioned. Conditioning looks at how much a perturbation changes the problem. For example, given data dand solution s, we can observe a true problem as s= f(However, the perturbed problem due to floating point mapping is said to be some new solution s’= f(fl(d)). To determine the conditioning of the problem is to determine the difference between s= f(d) and s’= f(fl(d)). However,
,
A
d).
Chase HeafnerAssignment 1Computational Financeconditioning, although dependent on the problem, is independent of the algorithm used to solve the problem. Stability, on the other hand, is dependent on the algorithm. When comparing stability and conditioning we can make the following three conclusions: 1) A stable algorithm on a well-conditioned problem produces accurate results. 2) An unstable algorithm on a well-conditioned problem may produce inaccurate results. 3 ) A stable algorithm on an ill-conditioned problem may produce inaccurate results. IV. Description of the Algorithm and Implementation 1.1.a.
• • • 