/ test / test_gmpy2_const.txt
test_gmpy2_const.txt
 1  Constants
 2  =========
 3  
 4  >>> import gmpy2
 5  
 6  >>> gmpy2.const_pi()
 7  mpfr('3.1415926535897931')
 8  >>> gmpy2.const_pi(100)
 9  mpfr('3.1415926535897932384626433832793',100)
10  >>> gmpy2.const_pi(100,200)
11  Traceback (most recent call last):
12    File "<stdin>", line 1, in <module>
13  TypeError: function takes at most 1 argument (2 given)
14  >>> gmpy2.const_pi(prec=100)
15  Traceback (most recent call last):
16    File "<stdin>", line 1, in <module>
17  TypeError: 'prec' is an invalid keyword argument for this function
18  >>> gmpy2.const_pi(precision=100)
19  mpfr('3.1415926535897932384626433832793',100)
20  >>> gmpy2.ieee(32).const_pi()
21  mpfr('3.14159274',24)
22  >>> gmpy2.ieee(32).const_pi(100)
23  Traceback (most recent call last):
24    File "<stdin>", line 1, in <module>
25  TypeError: const_pi() takes no arguments (1 given)
26  >>> gmpy2.ieee(128).const_pi()
27  mpfr('3.1415926535897932384626433832795028',113)
28  
29  >>> gmpy2.const_log2()
30  mpfr('0.69314718055994529')
31  >>> gmpy2.const_log2(100)
32  mpfr('0.69314718055994530941723212145798',100)
33  >>> gmpy2.const_log2(100,200)
34  Traceback (most recent call last):
35    File "<stdin>", line 1, in <module>
36  TypeError: function takes at most 1 argument (2 given)
37  >>> gmpy2.const_log2(prec=100)
38  Traceback (most recent call last):
39    File "<stdin>", line 1, in <module>
40  TypeError: 'prec' is an invalid keyword argument for this function
41  >>> gmpy2.const_log2(precision=100)
42  mpfr('0.69314718055994530941723212145798',100)
43  >>> gmpy2.ieee(32).const_log2()
44  mpfr('0.693147182',24)
45  >>> gmpy2.ieee(32).const_log2(100)
46  Traceback (most recent call last):
47    File "<stdin>", line 1, in <module>
48  TypeError: const_log2() takes no arguments (1 given)
49  >>> gmpy2.ieee(128).const_log2()
50  mpfr('0.693147180559945309417232121458176575',113)
51  
52  >>> gmpy2.const_catalan()
53  mpfr('0.91596559417721901')
54  >>> gmpy2.const_catalan(100)
55  mpfr('0.91596559417721901505460351493252',100)
56  >>> gmpy2.const_catalan(100,200)
57  Traceback (most recent call last):
58    File "<stdin>", line 1, in <module>
59  TypeError: function takes at most 1 argument (2 given)
60  >>> gmpy2.const_catalan(prec=100)
61  Traceback (most recent call last):
62    File "<stdin>", line 1, in <module>
63  TypeError: 'prec' is an invalid keyword argument for this function
64  >>> gmpy2.const_catalan(precision=100)
65  mpfr('0.91596559417721901505460351493252',100)
66  >>> gmpy2.ieee(32).const_catalan()
67  mpfr('0.915965617',24)
68  >>> gmpy2.ieee(32).const_catalan(100)
69  Traceback (most recent call last):
70    File "<stdin>", line 1, in <module>
71  TypeError: const_catalan() takes no arguments (1 given)
72  >>> gmpy2.ieee(128).const_catalan()
73  mpfr('0.915965594177219015054603514932384146',113)
74  
75  >>> gmpy2.const_euler()
76  mpfr('0.57721566490153287')
77  >>> gmpy2.const_euler(100)
78  mpfr('0.57721566490153286060651209008234',100)
79  >>> gmpy2.const_euler(100,200)
80  Traceback (most recent call last):
81    File "<stdin>", line 1, in <module>
82  TypeError: function takes at most 1 argument (2 given)
83  >>> gmpy2.const_euler(prec=100)
84  Traceback (most recent call last):
85    File "<stdin>", line 1, in <module>
86  TypeError: 'prec' is an invalid keyword argument for this function
87  >>> gmpy2.const_euler(precision=100)
88  mpfr('0.57721566490153286060651209008234',100)
89  >>> gmpy2.ieee(32).const_euler()
90  mpfr('0.577215672',24)
91  >>> gmpy2.ieee(32).const_euler(100)
92  Traceback (most recent call last):
93    File "<stdin>", line 1, in <module>
94  TypeError: const_euler() takes no arguments (1 given)
95  >>> gmpy2.ieee(128).const_euler()
96  mpfr('0.577215664901532860606512090082402471',113)
97