]> git.donarmstrong.com Git - lilypond.git/commitdiff
add Rational::to_double()
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 7 Jan 2007 00:58:50 +0000 (01:58 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 7 Jan 2007 00:58:50 +0000 (01:58 +0100)
flower/include/rational.hh
flower/rational.cc

index 511b8c2460bdd279187e7b45af4c2e86e52065d3..5effd3787af9ef3249f37b9b24b5701b93058c7c 100644 (file)
@@ -45,7 +45,8 @@ public:
   void negate ();
   int to_int () const;
 
-  operator double () const;
+  operator double () const { return to_double (); }
+  double to_double () const;
 
   Rational operator - () const;
   /**
index 6822703256a410433e3235c4fa263b389357a08a..0e3ab3069488885d93ed69681aefe75d7cc46808 100644 (file)
@@ -16,7 +16,8 @@ using namespace std;
 #include "string-convert.hh"
 #include "libc-extension.hh"
 
-Rational::operator double () const
+double
+Rational::to_double () const
 {
   if (sign_ == -1 || sign_ == 1 || sign_ == 0)
     return ((double)sign_) * num_ / den_;