22#include "absl/strings/str_cat.h"
23#include "absl/strings/string_view.h"
36 }
else if (
x == -kInfinity) {
40 const int64_t numerator = fraction.first;
41 const int64_t denominator = fraction.second;
42 return denominator == 1 ? absl::StrCat(numerator)
43 : absl::StrCat(numerator,
"/", denominator);
48 std::numeric_limits<double>::epsilon())
56 if (
a == 0.0)
return "";
std::string StringifyRational(const double x, const double precision)
std::string Stringify(const Fractional x, bool fraction)
std::string StringifyMonomial(const Fractional a, absl::string_view x, bool fraction)
static double ToDouble(double f)
In SWIG mode, we don't want anything besides these top-level includes.
Fraction RationalApproximation(const double x, const double precision)
std::pair< int64_t, int64_t > Fraction