Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Interval Arithmetic: In many branches of computational science, a serious issue is the numerical rounding that occurs when calculations are performed with the finite precision
Interval Arithmetic: In many branches of computational science, a serious issue is the numerical rounding that occurs when calculations are performed with the finite precision representation of floating-point numbers used in CPUs. A way of managing this source of error is the use of Interval Arithmetic. With Interval Arithmetic, numerical quantities are specified by the range of values they definitely lie between, i.e. a value v may be characterised by the interval {Vimin, Vmax} denoting that it is certain that Vimin Sus Vmax. As an illustration, it might be expressed as the interval (3.13, 3.15} By performing a set of calculations using such intervals a measure of the uncertainty of the final result is obtained. This is often used to speed up intensive sequences of operations, for example involving the many pixels in a computer graphics image. (For example, let us say that if the distance of a pixel on a game character from the camera is 1 m then we can make the decision about the drawing method with certainty. We didn't need the exact distance value to make the decision, just confidence that it is >1m.) The following basic rules define how to arithmetically combine pairs of intervals, (amin, amax} and {bmin, bmax), to give a result interval (Cmin, Cmax} c=a+b: {cmin, Cmax}={amin+bmin, amax+ b max} C=a-b: {cmin, Cmax}={amin-bmax, a maxt bmin} c=a*b: {cmin, Cmax}={ The minimum of amin*bmin, amin*bmax, a max*bmin, amax*bmax The maximum of amin*bmin, amin #bmax, amax*bmin, a max*bmax } c=a/b: {Cmin, Cmax}={ The minimum of amin/bmin, amin/bmax, amax/bmin, amax/bmax The maximum of amin/bmin, amin/bmax, amax/bmin, amax/bmax } Initial Overall Task Specification (Budget: 60 mins work): Your task is to develop a class to encapsulate interval arithmetic. Use of this class for computations should behave as similarly as possible to the use of the intrinsic types, floats or doubles etc. Your class must contain two member variables, min and max, whose values can only be changed by member functions and friends of the class, but whose values can be read by all. You are specifically required to ensure that your class can be used by the main code given below. int main(>a; float f(5.); interval g=a+f; // and as a professional you realise that this suggests you should also add? // A challenge for that final 1/50 mark - i.e. just to prove you can and beat the crowd interval h=f+a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started