Make digits shown by str(Real) reflect the precision more accurately
commit54c0646bb1d4571d7465c54b98335f651cf4a931
authorFredrik Johansson <fredrik.johansson@gmail.com>
Mon, 18 Aug 2008 14:48:33 +0000 (18 16:48 +0200)
committerFredrik Johansson <fredrik.johansson@gmail.com>
Mon, 18 Aug 2008 14:48:33 +0000 (18 16:48 +0200)
treeb260ce4d285273db38a52b1533c83e16d9778bf8
parent9cf81a668464d31e47942f880927ca0b5ad287df
Make digits shown by str(Real) reflect the precision more accurately

* Only display an exponent (no mantissa) if decimal precision < 1
* Don't strip trailing zeros

Before:

>>> N(cos(Rational(1,10000)))
0.999999995
>>> N(fibonacci(1000) - GoldenRatio**1000/sqrt(5))
-4.0e+84
>>> N(10**90 + fibonacci(1000) - GoldenRatio**1000/sqrt(5))
1.0e+90
>>> N(10**95 + fibonacci(1000) - GoldenRatio**1000/sqrt(5))
1.0e+95

After:

>>> N(cos(Rational(1,10000)))
0.999999995000000
>>> N(fibonacci(1000) - GoldenRatio**1000/sqrt(5))
-.0e+84
>>> N(10**90 + fibonacci(1000) - GoldenRatio**1000/sqrt(5))
1.000e+90
>>> N(10**95 + fibonacci(1000) - GoldenRatio**1000/sqrt(5))
1.000000000e+95

Acked-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
sympy/concrete/summations.py
sympy/core/tests/test_evalf.py
sympy/core/tests/test_numbers.py
sympy/geometry/point.py
sympy/integrals/tests/test_integrals.py
sympy/printing/str.py
sympy/printing/tests/test_str.py
sympy/statistics/distributions.py