#include <rational.h>
Public Methods | |
rational () | |
rational (char *str) | |
rational (const rational< T > &b) | |
rational (int w) | |
rational (T w) | |
rational (T u, T v) | |
rational< T > & | operator= (const rational< T > &b) |
int | sign () const |
Friends | |
ostream & | operator<< (ostream &s, const rational< T > &x) |
istream & | operator>> (istream &s, rational< T > &x) |
int | cmp (const rational< T > &a, const rational< T > &b) |
int | operator== (const rational< T > &a, const rational< T > &b) |
int | operator!= (const rational< T > &a, const rational< T > &b) |
int | operator> (const rational< T > &a, const rational< T > &b) |
int | operator>= (const rational< T > &a, const rational< T > &b) |
int | operator< (const rational< T > &a, const rational< T > &b) |
int | operator<= (const rational< T > &a, const rational< T > &b) |
int | is_integer (const rational< T > &a) |
rational< T > | ceil (const rational< T > &a) |
rational< T > | floor (const rational< T > &a) |
rational< T > | frac (const rational< T > &a) |
T | iceil (const rational< T > &a) |
T | ifloor (const rational< T > &a) |
rational< T > | operator+ (const rational< T > &a) |
rational< T > | operator- (const rational< T > &a) |
rational< T > | operator+ (const rational< T > &b, const rational< T > &c) |
rational< T > | operator- (const rational< T > &b, const rational< T > &c) |
rational< T > | operator * (const rational< T > &b, const rational< T > &c) |
rational< T > | operator/ (const rational< T > &b, const rational< T > &c) |
rational< T > | operator+= (rational< T > &b, const rational< T > &c) |
rational< T > | operator-= (rational< T > &b, const rational< T > &c) |
rational< T > | operator *= (rational< T > &b, const rational< T > &c) |
rational< T > | operator/= (rational< T > &b, const rational< T > &c) |
int | cmp (const rational< T > &a, const rational< T > &b) |
rational< T > | operator+ (const rational< T > &a) |
rational< T > | operator- (const rational< T > &a) |
An instance of this type is a rational number where the numerator and the denominator are both of type T.
Definition at line 60 of file rational.h.
|
Creates an instance of type rational.
Definition at line 212 of file rational.h. |
|
Converts s to a rational number.
Definition at line 219 of file rational.h. |
|
Makes a copy of a number.
Definition at line 233 of file rational.h. |
|
Creates an instance and initializes it with the value of w.
Definition at line 240 of file rational.h. |
|
Creates an instance and initializes it with the value of w.
Definition at line 247 of file rational.h. |
|
Creates an instance and initializes it with the value of u/w.
Definition at line 255 of file rational.h. |
|
Assignment.
Definition at line 263 of file rational.h. |
|
Sign of a number. Returns
Definition at line 387 of file rational.h. |
|
Returns the next bigger integer.
Definition at line 481 of file rational.h. |
|
Returns
Definition at line 395 of file rational.h. |
|
Compares two rationals. Returns
Definition at line 395 of file rational.h. |
|
Returns the next smaller integer.
Definition at line 464 of file rational.h. |
|
Returns the fractal part of the number.
Definition at line 498 of file rational.h. |
|
Returns the next bigger integer.
Definition at line 487 of file rational.h. |
|
Returns the next smaller integer.
Definition at line 470 of file rational.h. |
|
Returns 1 if a is integer.
Definition at line 312 of file rational.h. |
|
Multiplication.
Definition at line 340 of file rational.h. |
|
Combined assignment-multiplication operator.
Definition at line 376 of file rational.h. |
|
Test for inequality.
Definition at line 413 of file rational.h. |
|
Unary plus.
Definition at line 437 of file rational.h. |
|
Binary plus.
Definition at line 320 of file rational.h. |
|
Unary plus.
Definition at line 437 of file rational.h. |
|
Combined assignment-addition operator.
Definition at line 364 of file rational.h. |
|
Unary minus.
Definition at line 443 of file rational.h. |
|
Binary minus.
Definition at line 330 of file rational.h. |
|
Unary minus.
Definition at line 443 of file rational.h. |
|
Combined assignment-subtraction operator.
Definition at line 370 of file rational.h. |
|
Divizion.
Definition at line 352 of file rational.h. |
|
Combined assignment-division operator.
Definition at line 382 of file rational.h. |
|
Test for less.
Definition at line 401 of file rational.h. |
|
Writes a rational number.
Definition at line 272 of file rational.h. |
|
Test for less than or equal to.
Definition at line 431 of file rational.h. |
|
Test for equality.
Definition at line 407 of file rational.h. |
|
Test for greater.
Definition at line 419 of file rational.h. |
|
Test for greater than or equal to.
Definition at line 425 of file rational.h. |
|
Reads a rational number.
Definition at line 292 of file rational.h. |