| |||||||

| |||||||

Prototype
| |||||||

template <class Tnum>
interval<Tnum> pos_half(const interval<Tnum>& x) ;
| |||||||

Description
| |||||||

Returns the positive portion of an interval. That is, the
subset of the original interval in which all members are >0.
If none of the interval is positive, it returns a NaN.
positive half of [-3,5] would be [0,5].positive half of [3,5] would be [3,5].positive half of [-2,-2] would be NaN.
| |||||||

Definition
| |||||||

interval.cct | |||||||

Preconditions
| |||||||

| |||||||

Complexity
| |||||||

Example
| |||||||

In half.cc:
cout << "positive half :" << pos_half(A) << endl; cout << "negative half :" << neg_half(A) << endl; cout << "midpoint :" << midpoint(A) << endl; cout << "bisect (left) :" << bisect(A).first << endl; cout << "bisect (right):" << bisect(A).second << endl; cout << "diameter :" << diameter(A) << endl; cout << "abs :" << abs(A) << endl; | |||||||

Notes
| |||||||

See also
| |||||||

Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.