File: precision.py

package info (click to toggle)
sympy 0.7.5-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,576 kB
  • ctags: 27,948
  • sloc: python: 213,240; xml: 359; makefile: 117; sh: 53; lisp: 4
file content (22 lines) | stat: -rwxr-xr-x 439 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python

"""Precision Example

Demonstrates SymPy's arbitrary integer precision abilities
"""

import sympy
from sympy import Mul, Pow, S


def main():
    x = Pow(2, 50, evaluate=False)
    y = Pow(10, -50, evaluate=False)
    # A large, unevaluated expression
    m = Mul(x, y, evaluate=False)
    # Evaluating the expression
    e = S(2)**50/S(10)**50
    print("%s == %s" % (m, e))

if __name__ == "__main__":
    main()