code_junkie

Pure Python rational numbers module for 2.5

Nov 12th, 2011
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. >>> from sympy import *
  2. >>> a = Rational(1,2)
  3.  
  4. >>> a
  5. 1/2
  6.  
  7. >>> a*2
  8. 1
  9.  
  10. >>> Rational(2)**50/Rational(10)**50
  11. 1/88817841970012523233890533447265625
  12.  
  13. >>> from Rat import rat
  14. >>> rat(1) / rat(3)
  15. Rat(1,3)
  16. >>> rat(1, 3) ** 2
  17. Rat(1,9)
Add Comment
Please, Sign In to add comment