Simpatico  v1.10
Rational.cpp
1 /*
2 * Util Package - C++ Utilities for Scientific Computation
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "Rational.h"
9 
10 namespace Util
11 {
12 
13  /*
14  * Output stream inserter for a Rational.
15  */
16  std::ostream& operator << (std::ostream& out, Rational const &a)
17  {
18  out << a.num_;
19  if (a.den_ != 1) {
20  out << "/" << a.den_ ;
21  }
22  return out;
23  }
24 
25 }
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition: Pair.h:57
Utility classes for scientific computation.
Definition: accumulators.mod:1
A Rational number (a ratio of integers).
Definition: Rational.h:33