A fraction (i.e. a thing with an integer numerator and an integer denominator).
More...
#include <types.h>
|
| Fraction ()=default |
|
| Fraction (std::string s) |
|
| Fraction (int n, int d) |
|
float | as_float () const |
|
std::string | as_string () const |
|
|
int | numerator = 0 |
|
int | denominator = 0 |
|
A fraction (i.e. a thing with an integer numerator and an integer denominator).
Definition at line 167 of file types.h.
◆ Fraction() [1/3]
dcp::Fraction::Fraction |
( |
| ) |
|
|
default |
Construct a fraction of 0/0
◆ Fraction() [2/3]
Fraction::Fraction |
( |
std::string |
s | ) |
|
|
explicit |
Construct a Fraction from a string of the form "numerator denominator" e.g. "1 3".
Definition at line 79 of file types.cc.
◆ Fraction() [3/3]
dcp::Fraction::Fraction |
( |
int |
n, |
|
|
int |
d |
|
) |
| |
|
inline |
Construct a fraction with a specified numerator and denominator.
- Parameters
-
n | Numerator. |
d | Denominator. |
Definition at line 178 of file types.h.
The documentation for this class was generated from the following files: