diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-10 10:47:09 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-10 10:47:09 +0100 |
| commit | 608e055d35cd20fcc6734ca600bef3e9d56daca0 (patch) | |
| tree | 013394892440e2f1d2d9095facec2f2a689da6ff /src/types.h | |
| parent | f853cbd6d1ca683a3403202357b02041626abd84 (diff) | |
Add a couple of accessors.
Diffstat (limited to 'src/types.h')
| -rw-r--r-- | src/types.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/types.h b/src/types.h index 680f7be8..040e6197 100644 --- a/src/types.h +++ b/src/types.h @@ -101,6 +101,10 @@ public: */ Fraction (int n, int d) : numerator (n), denominator (d) {} + float as_float () const { + return float (numerator) / denominator; + } + int numerator; int denominator; }; |
