- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Musimathics_local/Musimat/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.

    00022 {
    00023         os << r.print();
    00024         Return os;
    00025 }

istream& operator>> | ( | istream & | is,
|  | Rational & | p |
| ) |  |  |

Definition at line 27 of file Rational.cpp.

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

    00028 {
    00029         char ch;
    00030         is >> ch && (ch == '{' || ch == '(')
    00031                 && is >> p.m_num >> ch && ch == ','
    00032                 && is >> p.m_den >> ch && (ch == '}' || ch == '(');
    00033         Return is;
    00034 }

RationalList RealListToRationalList | ( | RealList | R | ) |

Convert a RealList to a RationalList.

Parameters:

  | R | RealList

Returns:
  RationalList

Definition at line 36 of file Rational.cpp.

References For, Length(), and Return.

    00037 {
    00038         RationalList L;
    00039         For (Integer i = 0; i < Length( R ); i++ ) {
    00040                 Rational x(R[i]);
    00041                 L[i] = x;
    00042         }
    00043         Return( L );
    00044 }