Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Produce a single .h file containing your design for the interface for the Interval Arithmetic class described in the Initial Overall Specification above: (c++) Interval
Produce a single .h file containing your design for the interface for the Interval Arithmetic class described in the Initial Overall Specification above: (c++)
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 {Vmin, Vmax} denoting that it is certain that Vmin SVS 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, a max} 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, amax+ b min} c=a*b: {Cmin, Cmax}={ The minimum of amin* b min, amin* bmax, amax*bmin, amax*bmax The maximum of amin* bmin, amin* bmax, a max* bmin, amax* b max } c=a/b: {Cmin, Cmax}={ The minimum of amin/bmin, amin/bmax, amax/bmin, a max/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() { interval x; // Default initialisation interval y(3.0,3.1); // Initialisation from complete data // Sensible (?) initialisation from a single float interval z(7); interval a(x); a=X; interval *intptr=new interval[4]; delete[] intptr; } Note well: The client states that they may come back to you with an Upgrade request (see below) The following sub task counts 30% of the mark for this exercise Sub Task Specification (Budget: 30 mins work): Produce a single .h file containing your design for the interface for the Interval Arithmetic class described in the Initial Overall Specification aboveStep 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