sqr Programmers Guide Contents | Index |  Search

Category:intervals,math Component type:function
Prototype
template <class Tnum>
interval<Tnum> sqr(const interval<Tnum>& x) ;
Description
Squares an interval, returning a properly outward rounded interval. Squares each bound with outward rounding and returns a proper interval.
``` sqr(x)= [sup(x)*sup(x),inf(x)*inf(x)] if all negative interval [inf(x)*inf(x),sup(x)*sup(x)] if stradle zero interval and inf(x) < sup(x) [sup(x)*sup(x),inf(x)*inf(x)] if stradle zero interval and inf(x) > sup(x) [inf(x)*inf(x),sup(x)*sup(x)] if all positive interval ```
Definition
interval.cct
Preconditions
Complexity
Example
In mathfunc.cc:
```  cout << "A:" << A << endl << endl;
cout << "Square     :" << sqr(A) << endl;
cout << "Square Root:" << sqrt(A) << endl;
cout << "Tangent    :" << tan(A) << endl;
cout << "ArcTangent :" << atan(A) << endl;
cout << "Sine       :" << sin(A) << endl;
cout << "Cosine     :" << cos(A) << endl;
cout << "Arcsine    :" << asin(A) << endl;
cout << "Arcosine   :" << acos(A) << endl;
cout << "Log        :" << log(A) << endl;
cout << "Ln         :" << ln(A) << endl;
cout << "Power (A^A):" << pow(A,A) << endl;
cout << "Exponent   :" << exp(A) << endl;

```
Notes