def _print_Real(self, expr): prec = expr._prec if prec < 5: dps = 0 else: dps = prec_to_dps(expr._prec) return mlib.to_str(expr._mpf_, dps, strip_zeros=False)
def _print_Real(self, expr): prec = expr._prec if prec < 5: dps = 0 else: dps = prec_to_dps(expr._prec) if self._settings["full_prec"] == True: strip = False elif self._settings["full_prec"] == False: strip = True elif self._settings["full_prec"] == "auto": strip = self._print_level > 1 return mlib.to_str(expr._mpf_, dps, strip_zeros=strip)
def _print_Real(self, expr): # Based off of that in StrPrinter dps = prec_to_dps(expr._prec) str_real = mlib.to_str(expr._mpf_, dps, strip_zeros=True) # Must always have a mul symbol (as 2.5 10^{20} just looks odd) seperator = r" \times " if self._settings["mul_symbol"] is not None: seperator = self._settings["mul_symbol_latex"] if "e" in str_real: (mant, exp) = str_real.split("e") if exp[0] == "+": exp = exp[1:] return r"%s%s10^{%s}" % (mant, seperator, exp) elif str_real == "+inf": return r"\infty" elif str_real == "-inf": return r"- \intfy" else: return str_real
def _print_Real(self, expr): dps = prec_to_dps(expr._prec) r = mlib.to_str(expr._mpf_, repr_dps(expr._prec)) return "%s('%s', prec=%i)" % (expr.__class__.__name__, r, dps)