source file of the Flower Library
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "rational.hh"
#include <cmath>
#include <cstdlib>
+using namespace std;
#include "string-convert.hh"
#include "libc-extension.hh"
return (*this += r);
}
-String
+string
Rational::to_string () const
{
if (is_infinity ())
{
- String s (sign_ > 0 ? "" : "-");
- return String (s + "infinity");
+ string s (sign_ > 0 ? "" : "-");
+ return string (s + "infinity");
}
- String s = ::to_string (num ());
+ string s = ::to_string (num ());
if (den () != 1 && num ())
s += "/" + ::to_string (den ());
return s;
int
Rational::to_int () const
{
- return num () / den ();
+ return (int) num () / den ();
}
int