subset [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:intervals,math Component type:function
Prototype
template <class Tnum>
bool subset(const Tnum& x, const interval<Tnum>& y) ;
Description
Tests if the number x is within the bounds of the interval y (inclusive).
Definition
interval.cct
Preconditions
Complexity
Example
In subset.cc:
  dint A(-2,2,true);
  dint B(-1,1);
  cout << "A in B? " << subset(A,B) <<endl;
  cout << "B in A? " << subset(B,A) <<endl;
  cout << "0 in A? " << subset(double(0),A) << endl;
  cout << "3 in A? " << subset(double(3),A) << endl;

  cout << "B Proper subset of A? " << proper_subset(B,A) << endl;
  cout << "B Proper subset of B? " << proper_subset(B,B) << endl;

Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.