fuzzylogician / gmpy

Automatically exported from code.google.com/p/gmpy
GNU Lesser General Public License v3.0
0 stars 0 forks source link

gmpy2.context() doesn't work correct on window 7 64bit python2.7 #52

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
import gmpy2
gmpy2.context().precision=100
print gmpy2.context() 
#here the precision still remain as 53
#I also try gmpy2.context(precision=100),it doesn't change the precision too
#I tested both on python2.7 32bit and 64bit under window7 64bit

Original issue reported on code.google.com by 1989l...@gmail.com on 15 Apr 2012 at 9:30

GoogleCodeExporter commented 8 years ago
I assume you are using the beta release.

gmpy2.context() returns a new context based on the built-in defaults. It 
doesn't modify the existing context.

If you want to set the context to the default context plus precision set to 
100, use the following:

gmpy2.set_context(gmpy2.context(precision=100))

gmpy2.get_context() returns a reference to the existing active context. To 
change the precision of the active context to 100 and leave everything else "as 
is", use:

gmpy2.get_context().precision=100

I tried to follow the use of contexts in the decimal library but I agree it can 
get confusing.

casevh

Original comment by casevh on 15 Apr 2012 at 2:29

GoogleCodeExporter commented 8 years ago
thanks for your reply.
I am clear now.

2012/4/15, gmpy@googlecode.com <gmpy@googlecode.com>:

Original comment by 1989l...@gmail.com on 17 Apr 2012 at 3:51

GoogleCodeExporter commented 8 years ago
Thank you for the feedback. I'll clarify this issue in the documentation.

Original comment by casevh on 18 Apr 2012 at 5:05