Functions

/Users/garethloy/Musimathics/Musimat1.2/MusimatLib/Rational.cpp File Reference

#include "Musimat.h"
#include "float.h"

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, Rational &r)
istream & operator>> (istream &is, Rational &p)
RationalList RealListToRationalList (RealList R)
 Convert a RealList to a RationalList.

Function Documentation

ostream& operator<< ( ostream &  os,
Rational r 
)

Definition at line 21 of file Rational.cpp.

References Rational::print(), and Return.

{
        os << r.print();
        Return os;
}
istream& operator>> ( istream &  is,
Rational p 
)

Definition at line 27 of file Rational.cpp.

References Rational::m_den, Rational::m_num, and Return.

{
        char ch;
        is >> ch && (ch == '{' || ch == '(')
                && is >> p.m_num >> ch && ch == ','
                && is >> p.m_den >> ch && (ch == '}' || ch == '(');
        Return is;
}
RationalList RealListToRationalList ( RealList  R )

Convert a RealList to a RationalList.

Parameters:
RRealList
Returns:
RationalList

Definition at line 36 of file Rational.cpp.

References For, Length(), and Return.

{
        RationalList L;
        For (Integer i = 0; i < Length( R ); i++ ) {
                Rational x(R[i]);
                L[i] = x;
        }
        Return( L );
}