Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(206108)

Side by Side Diff: Modules/_decimal/docstrings.h

Issue 27779: Sync-up docstrings in C version of the the decimal module
Patch Set: Created 3 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/_pydecimal.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2001-2012 Python Software Foundation. All Rights Reserved. 2 * Copyright (c) 2001-2012 Python Software Foundation. All Rights Reserved.
3 * Modified and extended by Stefan Krah. 3 * Modified and extended by Stefan Krah.
4 */ 4 */
5 5
6 6
7 #ifndef DOCSTRINGS_H 7 #ifndef DOCSTRINGS_H
8 #define DOCSTRINGS_H 8 #define DOCSTRINGS_H
9 9
10 10
11 #include "pymacro.h" 11 #include "pymacro.h"
12 12
13 13
14 /******************************************************************************/ 14 /******************************************************************************/
15 /* Module */ 15 /* Module */
16 /******************************************************************************/ 16 /******************************************************************************/
17 17
18 18
19 PyDoc_STRVAR(doc__decimal, 19 PyDoc_STRVAR(doc__decimal,
20 "C decimal arithmetic module"); 20 "This is an implementation of decimal floating point arithmetic based on\n\
21 the General Decimal Arithmetic Specification:\n\
22 \n\
23 http://speleotrove.com/decimal/decarith.html\n\
24 \n\
25 and IEEE standard 854-1987:\n\
26 \n\
27 http://en.wikipedia.org/wiki/IEEE_854-1987\n\
28 \n\
29 Decimal floating point has finite precision with arbitrarily large bounds.\n\
30 \n\
31 The purpose of this module is to support arithmetic using familiar\n\
32 \"schoolhouse\" rules and to avoid some of the tricky representation\n\
33 issues associated with binary floating point. The package is especially\n\
34 useful for financial applications or for contexts where users have\n\
35 expectations that are at odds with binary floating point (for instance,\n\
36 in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead\n\
37 of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected\n\
38 Decimal('0.00')).\n\
39 \n\
40 Here are some examples of using the decimal module:\n\
41 \n\
42 >>> from decimal import *\n\
43 >>> setcontext(ExtendedContext)\n\
44 >>> Decimal(0)\n\
45 Decimal('0')\n\
46 >>> Decimal('1')\n\
47 Decimal('1')\n\
48 >>> Decimal('-.0123')\n\
49 Decimal('-0.0123')\n\
50 >>> Decimal(123456)\n\
51 Decimal('123456')\n\
52 >>> Decimal('123.45e12345678')\n\
53 Decimal('1.2345E+12345680')\n\
54 >>> Decimal('1.33') + Decimal('1.27')\n\
55 Decimal('2.60')\n\
56 >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')\n\
57 Decimal('-2.20')\n\
58 >>> dig = Decimal(1)\n\
59 >>> print(dig / Decimal(3))\n\
60 0.333333333\n\
61 >>> getcontext().prec = 18\n\
62 >>> print(dig / Decimal(3))\n\
63 0.333333333333333333\n\
64 >>> print(dig.sqrt())\n\
65 1\n\
66 >>> print(Decimal(3).sqrt())\n\
67 1.73205080756887729\n\
68 >>> print(Decimal(3) ** 123)\n\
69 4.85192780976896427E+58\n\
70 >>> inf = Decimal(1) / Decimal(0)\n\
71 >>> print(inf)\n\
72 Infinity\n\
73 >>> neginf = Decimal(-1) / Decimal(0)\n\
74 >>> print(neginf)\n\
75 -Infinity\n\
76 >>> print(neginf + inf)\n\
77 NaN\n\
78 >>> print(neginf * inf)\n\
79 -Infinity\n\
80 >>> print(dig / 0)\n\
81 Infinity\n\
82 >>> getcontext().traps[DivisionByZero] = 1\n\
83 >>> print(dig / 0)\n\
84 Traceback (most recent call last):\n\
85 ...\n\
86 ...\n\
87 ...\n\
88 decimal.DivisionByZero: x / 0\n\
89 >>> c = Context()\n\
90 >>> c.traps[InvalidOperation] = 0\n\
91 >>> print(c.flags[InvalidOperation])\n\
92 0\n\
93 >>> c.divide(Decimal(0), Decimal(0))\n\
94 Decimal('NaN')\n\
95 >>> c.traps[InvalidOperation] = 1\n\
96 >>> print(c.flags[InvalidOperation])\n\
97 1\n\
98 >>> c.flags[InvalidOperation] = 0\n\
99 >>> print(c.flags[InvalidOperation])\n\
100 0\n\
101 >>> print(c.divide(Decimal(0), Decimal(0)))\n\
102 Traceback (most recent call last):\n\
103 ...\n\
104 ...\n\
105 ...\n\
106 decimal.InvalidOperation: 0 / 0\n\
107 >>> print(c.flags[InvalidOperation])\n\
108 1\n\
109 >>> c.flags[InvalidOperation] = 0\n\
110 >>> c.traps[InvalidOperation] = 0\n\
111 >>> print(c.divide(Decimal(0), Decimal(0)))\n\
112 NaN\n\
113 >>> print(c.flags[InvalidOperation])\n\
114 1\n\
115 >>>\n\
116 \n");
21 117
22 PyDoc_STRVAR(doc_getcontext, 118 PyDoc_STRVAR(doc_getcontext,
23 "getcontext($module, /)\n--\n\n\ 119 "getcontext($module, /)\n--\n\n\
24 Get the current default context.\n\ 120 Returns this thread's context.\n\
121 \n\
122 If this thread does not yet have a context, returns\n\
123 a new context and sets this thread's context.\n\
124 New contexts are copies of DefaultContext.\n\
25 \n"); 125 \n");
26 126
127 /*This seems clearer than the python version*/
27 PyDoc_STRVAR(doc_setcontext, 128 PyDoc_STRVAR(doc_setcontext,
28 "setcontext($module, context, /)\n--\n\n\ 129 "setcontext($module, context, /)\n--\n\n\
29 Set a new default context.\n\ 130 Set a new default context.\n\
30 \n"); 131 \n");
31 132
32 PyDoc_STRVAR(doc_localcontext, 133 PyDoc_STRVAR(doc_localcontext,
33 "localcontext($module, /, ctx=None)\n--\n\n\ 134 "localcontext($module, /, ctx=None)\n--\n\n\
34 Return a context manager that will set the default context to a copy of ctx\n\ 135 Return a context manager for a copy of the supplied context.\n\
skrah 2016/10/23 21:39:46 This is actually important in the age of asyncio.
lisroach 2016/12/01 22:44:42 Done.
35 on entry to the with-statement and restore the previous default context when\n\ 136 Uses a copy of the current context if no context is specified.\n\
36 exiting the with-statement. If no context is specified, a copy of the current\n\ 137 The returned context manager creates a local decimal context\n\
37 default context is used.\n\ 138 in a with statement:\n\
139 def sin(x):\n\
140 with localcontext() as ctx:\n\
141 ctx.prec += 2\n\
142 # Rest of sin calculation algorithm\n\
143 # uses a precision 2 greater than normal\n\
144 return +s # Convert result to normal precision\n\
145 \n\
146 def sin(x):\n\
147 with localcontext(ExtendedContext):\n\
148 # Rest of sin calculation algorithm\n\
149 # uses the Extended Context from the\n\
150 # General Decimal Arithmetic Specification\n\
151 return +s # Convert result to normal context\n\
152 \n\
153 >>> setcontext(DefaultContext)\n\
154 >>> print(getcontext().prec) # Return a context manager for a copy of the su pplied context\n\
155 \n\
156 Uses a copy of the current context if no context is specified.\n\
157 The returned context manager creates a local decimal context\n\
158 in a with statement:\n\
159 def sin(x):\n\
160 with localcontext() as ctx:\n\
161 ctx.prec += 2\n\
162 # Rest of sin calculation algorithm\n\
163 # uses a precision 2 greater than normal\n\
164 return +s # Convert result to normal precision\n\
165 \n\
166 def sin(x):\n\
167 with localcontext(ExtendedContext):\n\
168 # Rest of sin calculation algorithm\n\
169 # uses the Extended Context from the\n\
170 # General Decimal Arithmetic Specification\n\
171 return +s # Convert result to normal context\n\
172 \n\
173 >>> setcontext(DefaultContext)\n\
174 >>> print(getcontext().prec)\n\
175 28\n\
176 >>> with localcontext():\n\
177 ... ctx = getcontext()\n\
178 ... ctx.prec += 2\n\
179 ... print(ctx.prec)\n\
180 ...\n\
181 30\n\
182 >>> with localcontext(ExtendedContext):\n\
183 ... print(getcontext().prec)\n\
184 ...\n\
185 9\n\
186 >>> print(getcontext().prec)\n\
187 28\n\
188 28\n\
189 >>> with localcontext():\n\
190 ... ctx = getcontext()\n\
191 ... ctx.prec += 2\n\
192 ... print(ctx.prec)\n\
193 ...\n\
194 30\n\
195 >>> with localcontext(ExtendedContext):\n\
196 ... print(getcontext().prec)\n\
197 ...\n\
198 9\n\
199 >>> print(getcontext().prec)\n\
200 28\n\
38 \n"); 201 \n");
39 202
40 #ifdef EXTRA_FUNCTIONALITY 203 #ifdef EXTRA_FUNCTIONALITY
41 PyDoc_STRVAR(doc_ieee_context, 204 PyDoc_STRVAR(doc_ieee_context,
42 "IEEEContext($module, bits, /)\n--\n\n\ 205 "IEEEContext($module, bits, /)\n--\n\n\
43 Return a context object initialized to the proper values for one of the\n\ 206 Return a context object initialized to the proper values for one of the\n\
44 IEEE interchange formats. The argument must be a multiple of 32 and less\n\ 207 IEEE interchange formats. The argument must be a multiple of 32 and less\n\
45 than IEEE_CONTEXT_MAX_BITS. For the most common values, the constants\n\ 208 than IEEE_CONTEXT_MAX_BITS. For the most common values, the constants\n\
46 DECIMAL32, DECIMAL64 and DECIMAL128 are provided.\n\ 209 DECIMAL32, DECIMAL64 and DECIMAL128 are provided.\n\
47 \n"); 210 \n");
48 #endif 211 #endif
49 212
50 213
51 /******************************************************************************/ 214 /******************************************************************************/
52 /* Decimal Object and Methods */ 215 /* Decimal Object and Methods */
53 /******************************************************************************/ 216 /******************************************************************************/
54 217
55 PyDoc_STRVAR(doc_decimal, 218 PyDoc_STRVAR(doc_decimal,
56 "Decimal(value=\"0\", context=None)\n--\n\n\ 219 "Decimal(value=\"0\", context=None)\n--\n\n\
57 Construct a new Decimal object. 'value' can be an integer, string, tuple,\n\ 220 Construct a new Decimal object. 'value' can be an integer, string, tuple,\n\
58 or another Decimal object. If no value is given, return Decimal('0'). The\n\ 221 or another Decimal object. If no value is given, return Decimal('0'). The\n\
59 context does not affect the conversion and is only passed to determine if\n\ 222 context does not affect the conversion and is only passed to determine if\n\
60 the InvalidOperation trap is active.\n\ 223 the InvalidOperation trap is active.\n\
224 \n\
225 >>> Decimal('3.14') # string input\n\
226 Decimal('3.14')\n\
227 >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent)\n\
228 Decimal('3.14')\n\
229 >>> Decimal(314) # int\n\
230 Decimal('314')\n\
231 >>> Decimal(Decimal(314)) # another decimal instance\n\
232 Decimal('314')\n\
233 >>> Decimal(' 3.14 \\\\n') # leading and trailing whitespace okay\n\
234 Decimal('3.14')\n\
61 \n"); 235 \n");
62 236
63 PyDoc_STRVAR(doc_adjusted, 237 PyDoc_STRVAR(doc_adjusted,
64 "adjusted($self, /)\n--\n\n\ 238 "adjusted($self, /)\n--\n\n\
65 Return the adjusted exponent of the number. Defined as exp + digits - 1.\n\ 239 Return the adjusted exponent of the number. Defined as exp + digits - 1.\n\
66 \n"); 240 \n");
67 241
68 PyDoc_STRVAR(doc_as_tuple, 242 PyDoc_STRVAR(doc_as_tuple,
69 "as_tuple($self, /)\n--\n\n\ 243 "as_tuple($self, /)\n--\n\n\
70 Return a tuple representation of the number.\n\ 244 Represents the number as a triple tuple, to show the internals exactly as\n\
skrah 2016/10/23 21:39:46 This is outdated for the Python version and wrong
lisroach 2016/12/01 22:44:42 For python 3.7 it looks correct to me?
skrah 2017/04/06 18:58:35 I meant "show the internals exactly as they are".
245 they are.\n\
71 \n"); 246 \n");
72 247
73 PyDoc_STRVAR(doc_as_integer_ratio, 248 PyDoc_STRVAR(doc_as_integer_ratio,
74 "as_integer_ratio($self, /)\n--\n\n\ 249 "as_integer_ratio($self, /)\n--\n\n\
75 Decimal.as_integer_ratio() -> (int, int)\n\ 250 Express a finite Decimal instance in the form n / d.\n\
76 \n\ 251 Return a pair (n, d) of integers, whose ratio is exactly equal to the original\n \
77 Return a pair of integers, whose ratio is exactly equal to the original\n\
78 Decimal and with a positive denominator. The ratio is in lowest terms.\n\ 252 Decimal and with a positive denominator. The ratio is in lowest terms.\n\
79 Raise OverflowError on infinities and a ValueError on NaNs.\n\ 253 Raise OverflowError on infinities and a ValueError on NaNs.\n\
254 \n\
255 >>> Decimal('3.14').as_integer_ratio()\n\
256 (157, 50)\n\
257 >>> Decimal('-123e5').as_integer_ratio()\n\
258 (-12300000, 1)\n\
259 >>> Decimal('0.00').as_integer_ratio()\n\
260 (0, 1)\n\
80 \n"); 261 \n");
81 262
82 PyDoc_STRVAR(doc_canonical, 263 PyDoc_STRVAR(doc_canonical,
83 "canonical($self, /)\n--\n\n\ 264 "canonical($self, /)\n--\n\n\
84 Return the canonical encoding of the argument. Currently, the encoding\n\ 265 Returns the same Decimal object.\n\
85 of a Decimal instance is always canonical, so this operation returns its\n\ 266 As we do not have different encodings for the same number, the received\n\
86 argument unchanged.\n\ 267 object already is in its canonical form.\n\
268 \n\
269 >>> ExtendedContext.canonical(Decimal('2.50'))\n\
270 Decimal('2.50')\n\
87 \n"); 271 \n");
88 272
89 PyDoc_STRVAR(doc_compare, 273 PyDoc_STRVAR(doc_compare,
90 "compare($self, /, other, context=None)\n--\n\n\ 274 "compare($self, /, other, context=None)\n--\n\n\
91 Compare self to other. Return a decimal value:\n\ 275 Compares values numerically.\n\
92 \n\ 276 \n\
93 a or b is a NaN ==> Decimal('NaN')\n\ 277 If the signs of the operands differ, a value representing each operand\n\
94 a < b ==> Decimal('-1')\n\ 278 ('-1' if the operand is less than zero, '0' if the operand is zero or\n\
95 a == b ==> Decimal('0')\n\ 279 negative zero, or '1' if the operand is greater than zero) is used in\n\
96 a > b ==> Decimal('1')\n\ 280 place of that operand for the comparison instead of the actual\n\
281 operand.\n\
282 \n\
283 The comparison is then effected by subtracting the second operand from\n\
284 the first and then returning a value according to the result of the\n\
285 subtraction: '-1' if the result is less than zero, '0' if the result is\n\
286 zero or negative zero, or '1' if the result is greater than zero.\n\
287 \n\
288 a or b is a NaN ==> Decimal('NaN')\n\
289 a < b ==> Decimal('-1')\n\
290 a == b ==> Decimal('0')\n\
291 a > b ==> Decimal('1')\n\
292 \n\
293 >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))\n\
294 Decimal('-1')\n\
295 >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))\n\
296 Decimal('0')\n\
297 >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))\n\
298 Decimal('0')\n\
299 >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))\n\
300 Decimal('1')\n\
301 >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))\n\
302 Decimal('1')\n\
303 >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))\n\
304 Decimal('-1')\n\
305 >>> ExtendedContext.compare(1, 2)\n\
306 Decimal('-1')\n\
307 >>> ExtendedContext.compare(Decimal(1), 2)\n\
308 Decimal('-1')\n\
309 >>> ExtendedContext.compare(1, Decimal(2))\n\
310 Decimal('-1')\n\
311 >>> ExtendedContext.compare(Decimal('2'), Decimal('NaN'))\n\
312 Decimal('NaN')\n\
97 \n"); 313 \n");
98 314
99 PyDoc_STRVAR(doc_compare_signal, 315 PyDoc_STRVAR(doc_compare_signal,
100 "compare_signal($self, /, other, context=None)\n--\n\n\ 316 "compare_signal($self, /, other, context=None)\n--\n\n\
101 Identical to compare, except that all NaNs signal.\n\ 317 Compares the values of the two operands numerically.\n\
318 \n\
319 It's pretty much like compare(), but all NaNs signal, with signaling\n\
320 NaNs taking precedence over quiet NaNs.\n\
321 \n\
322 >>> c = ExtendedContext\n\
323 >>> c.compare_signal(Decimal('2.1'), Decimal('3'))\n\
324 Decimal('-1')\n\
325 >>> c.compare_signal(Decimal('2.1'), Decimal('2.1'))\n\
326 Decimal('0')\n\
327 >>> c.flags[InvalidOperation] = 0\n\
328 >>> print(c.flags[InvalidOperation])\n\
329 0\n\
330 >>> c.compare_signal(Decimal('NaN'), Decimal('2.1'))\n\
331 Decimal('NaN')\n\
332 >>> print(c.flags[InvalidOperation])\n\
333 1\n\
334 >>> c.flags[InvalidOperation] = 0\n\
335 >>> print(c.flags[InvalidOperation])\n\
336 0\n\
337 >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1'))\n\
338 Decimal('NaN')\n\
339 >>> print(c.flags[InvalidOperation])\n\
340 1\n\
341 >>> c.compare_signal(-1, 2)\n\
342 Decimal('-1')\n\
343 >>> c.compare_signal(Decimal(-1), 2)\n\
344 Decimal('-1')\n\
345 >>> c.compare_signal(-1, Decimal(2))\n\
346 Decimal('-1')\n\
102 \n"); 347 \n");
103 348
104 PyDoc_STRVAR(doc_compare_total, 349 PyDoc_STRVAR(doc_compare_total,
105 "compare_total($self, /, other, context=None)\n--\n\n\ 350 "compare_total($self, /, other, context=None)\n--\n\n\
106 Compare two operands using their abstract representation rather than\n\ 351 Compares two operands using their abstract representation rather than\n\
skrah 2016/10/23 21:39:46 Everyone has a preferred form. I think Guido prefe
lisroach 2016/12/01 22:44:42 Done.
107 their numerical value. Similar to the compare() method, but the result\n\ 352 their numerical value. Similar to the compare() method, but the result\n\
108 gives a total ordering on Decimal instances. Two Decimal instances with\n\ 353 gives a total ordering on Decimal instances.\n\
109 the same numeric value but different representations compare unequal\n\
skrah 2016/10/23 21:39:46 I'd leave this in. I tried to give examples only
lisroach 2016/12/01 22:44:42 Done.
110 in this ordering:\n\
111 \n\
112 >>> Decimal('12.0').compare_total(Decimal('12'))\n\
113 Decimal('-1')\n\
114 \n\ 354 \n\
115 Quiet and signaling NaNs are also included in the total ordering. The result\n\ 355 Quiet and signaling NaNs are also included in the total ordering. The result\n\
116 of this function is Decimal('0') if both operands have the same representation,\ n\ 356 of this function is Decimal('0') if both operands have the same representation,\ n\
117 Decimal('-1') if the first operand is lower in the total order than the second,\ n\ 357 Decimal('-1') if the first operand is lower in the total order than the second,\ n\
118 and Decimal('1') if the first operand is higher in the total order than the\n\ 358 and Decimal('1') if the first operand is higher in the total order than the\n\
119 second operand. See the specification for details of the total order.\n\ 359 second operand. See the specification for details of the total order.\n\
120 \n\ 360 \n\
121 This operation is unaffected by context and is quiet: no flags are changed\n\ 361 This operation is unaffected by context and is quiet: no flags are changed\n\
122 and no rounding is performed. As an exception, the C version may raise\n\ 362 and no rounding is performed. As an exception, the C version may raise\n\
123 InvalidOperation if the second operand cannot be converted exactly.\n\ 363 InvalidOperation if the second operand cannot be converted exactly.\n\
364 \n\
365 >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))\n\
366 Decimal('-1')\n\
367 >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12'))\n\
368 Decimal('-1')\n\
369 >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3'))\n\
370 Decimal('-1')\n\
371 >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30'))\n\
372 Decimal('0')\n\
373 >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300'))\n\
374 Decimal('1')\n\
375 >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN'))\n\
376 Decimal('-1')\n\
377 >>> ExtendedContext.compare_total(1, 2)\n\
378 Decimal('-1')\n\
379 >>> ExtendedContext.compare_total(Decimal(1), 2)\n\
380 Decimal('-1')\n\
381 >>> ExtendedContext.compare_total(1, Decimal(2))\n\
382 Decimal('-1')\n\
124 \n"); 383 \n");
125 384
126 PyDoc_STRVAR(doc_compare_total_mag, 385 PyDoc_STRVAR(doc_compare_total_mag,
127 "compare_total_mag($self, /, other, context=None)\n--\n\n\ 386 "compare_total_mag($self, /, other, context=None)\n--\n\n\
128 Compare two operands using their abstract representation rather than their\n\ 387 Compares two operands using their abstract representation rather than their\n\
129 value as in compare_total(), but ignoring the sign of each operand.\n\ 388 numerical value and with their sign ignored. Like compare_total, but with\n\
389 operand's sign ignored and assumed to be 0.\n\
130 \n\ 390 \n\
131 x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()) .\n\ 391 x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()) .\n\
132 \n\ 392 \n\
133 This operation is unaffected by context and is quiet: no flags are changed\n\ 393 This operation is unaffected by context and is quiet: no flags are changed\n\
134 and no rounding is performed. As an exception, the C version may raise\n\ 394 and no rounding is performed. As an exception, the C version may raise\n\
135 InvalidOperation if the second operand cannot be converted exactly.\n\ 395 InvalidOperation if the second operand cannot be converted exactly.\n\
136 \n"); 396 \n");
137 397
138 PyDoc_STRVAR(doc_conjugate, 398 PyDoc_STRVAR(doc_conjugate,
139 "conjugate($self, /)\n--\n\n\ 399 "conjugate($self, /)\n--\n\n\
140 Return self.\n\ 400 Returns self.\n\
141 \n"); 401 \n");
142 402
143 PyDoc_STRVAR(doc_copy_abs, 403 PyDoc_STRVAR(doc_copy_abs,
144 "copy_abs($self, /)\n--\n\n\ 404 "copy_abs($self, /)\n--\n\n\
145 Return the absolute value of the argument. This operation is unaffected by\n\ 405 Returns a copy of the operand with the sign set to 0. This operation is unaffect ed by\n\
skrah 2016/10/23 21:59:26 I think "sign set to zero" is a bit confusing for
lisroach 2016/12/01 22:44:42 Done.
lisroach 2016/12/01 22:44:42 Done.
146 context and is quiet: no flags are changed and no rounding is performed.\n\ 406 context and is quiet: no flags are changed and no rounding is performed.\n\
407 \n\
408 >>> ExtendedContext.copy_abs(Decimal('2.1'))\n\
409 Decimal('2.1')\n\
410 >>> ExtendedContext.copy_abs(Decimal('-100'))\n\
411 Decimal('100')\n\
412 >>> ExtendedContext.copy_abs(-1)\n\
413 Decimal('1')\n\
147 \n"); 414 \n");
148 415
149 PyDoc_STRVAR(doc_copy_negate, 416 PyDoc_STRVAR(doc_copy_negate,
150 "copy_negate($self, /)\n--\n\n\ 417 "copy_negate($self, /)\n--\n\n\
151 Return the negation of the argument. This operation is unaffected by context\n\ 418 Returns a copy of the operand with the sign inverted. This operation is\n\
152 and is quiet: no flags are changed and no rounding is performed.\n\ 419 unaffected by context and is quiet: no flags are changed and no rounding\n\
420 is performed.\n\
421 \n\
422 >>> ExtendedContext.copy_negate(Decimal('101.5'))\n\
423 Decimal('-101.5')\n\
424 >>> ExtendedContext.copy_negate(Decimal('-101.5'))\n\
425 Decimal('101.5')\n\
426 >>> ExtendedContext.copy_negate(1)\n\
427 Decimal('-1')\n\
153 \n"); 428 \n");
154 429
155 PyDoc_STRVAR(doc_copy_sign, 430 PyDoc_STRVAR(doc_copy_sign,
156 "copy_sign($self, /, other, context=None)\n--\n\n\ 431 "copy_sign($self, /, other, context=None)\n--\n\n\
157 Return a copy of the first operand with the sign set to be the same as the\n\ 432 Copies the second operand's sign to the first one.\n\
skrah 2016/10/23 21:39:46 That sounds as if it is a destructive update.
lisroach 2016/12/01 22:44:42 Done.
158 sign of the second operand. For example:\n\ 433 In detail, it returns a copy of the first operand with the sign\n\
434 equal to the sign of the second operand.\n\
159 \n\ 435 \n\
160 >>> Decimal('2.3').copy_sign(Decimal('-1.5'))\n\ 436 >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))\n\
161 Decimal('-2.3')\n\ 437 Decimal('1.50')\n\
438 >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33'))\n\
439 Decimal('1.50')\n\
440 >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33'))\n\
441 Decimal('-1.50')\n\
442 >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33'))\n\
443 Decimal('-1.50')\n\
444 >>> ExtendedContext.copy_sign(1, -2)\n\
445 Decimal('-1')\n\
446 >>> ExtendedContext.copy_sign(Decimal(1), -2)\n\
447 Decimal('-1')\n\
448 >>> ExtendedContext.copy_sign(1, Decimal(-2))\n\
449 Decimal('-1')\n\
162 \n\ 450 \n\
163 This operation is unaffected by context and is quiet: no flags are changed\n\ 451 This operation is unaffected by context and is quiet: no flags are changed\n\
164 and no rounding is performed. As an exception, the C version may raise\n\ 452 and no rounding is performed. As an exception, the C version may raise\n\
165 InvalidOperation if the second operand cannot be converted exactly.\n\ 453 InvalidOperation if the second operand cannot be converted exactly.\n\
166 \n"); 454 \n");
167 455
168 PyDoc_STRVAR(doc_exp, 456 PyDoc_STRVAR(doc_exp,
169 "exp($self, /, context=None)\n--\n\n\ 457 "exp($self, /, context=None)\n--\n\n\
170 Return the value of the (natural) exponential function e**x at the given\n\ 458 Return the value of the (natural) exponential function e ** a. The function alwa ys uses the ROUND_HALF_EVEN mode and the result\n\
171 number. The function always uses the ROUND_HALF_EVEN mode and the result\n\
172 is correctly rounded.\n\ 459 is correctly rounded.\n\
460 \n\
461 >>> c = ExtendedContext.copy()\n\
462 >>> c.Emin = -999\n\
463 >>> c.Emax = 999\n\
464 >>> c.exp(Decimal('-Infinity'))\n\
465 Decimal('0')\n\
466 >>> c.exp(Decimal('-1'))\n\
467 Decimal('0.367879441')\n\
468 >>> c.exp(Decimal('0'))\n\
469 Decimal('1')\n\
470 >>> c.exp(Decimal('1'))\n\
471 Decimal('2.71828183')\n\
472 >>> c.exp(Decimal('0.693147181'))\n\
473 Decimal('2.00000000')\n\
474 >>> c.exp(Decimal('+Infinity'))\n\
475 Decimal('Infinity')\n\
476 >>> c.exp(10)\n\
477 Decimal('22026.4658')\n\
173 \n"); 478 \n");
174 479
175 PyDoc_STRVAR(doc_from_float, 480 PyDoc_STRVAR(doc_from_float,
176 "from_float($type, f, /)\n--\n\n\ 481 "from_float($type, f, /)\n--\n\n\
177 Class method that converts a float to a decimal number, exactly.\n\ 482 Class method that converts a float to a decimal number, exactly.\n\
178 Since 0.1 is not exactly representable in binary floating point,\n\ 483 Since 0.1 is not exactly representable in binary floating point,\n\
179 Decimal.from_float(0.1) is not the same as Decimal('0.1').\n\ 484 Decimal.from_float(0.1) is not the same as Decimal('0.1').\n\
180 \n\ 485 \n\
181 >>> Decimal.from_float(0.1)\n\ 486 >>> Decimal.from_float(0.1)\n\
182 Decimal('0.1000000000000000055511151231257827021181583404541015625')\n\ 487 Decimal('0.1000000000000000055511151231257827021181583404541015625')\n\
183 >>> Decimal.from_float(float('nan'))\n\ 488 >>> Decimal.from_float(float('nan'))\n\
184 Decimal('NaN')\n\ 489 Decimal('NaN')\n\
185 >>> Decimal.from_float(float('inf'))\n\ 490 >>> Decimal.from_float(float('inf'))\n\
186 Decimal('Infinity')\n\ 491 Decimal('Infinity')\n\
187 >>> Decimal.from_float(float('-inf'))\n\ 492 >>> Decimal.from_float(float('-inf'))\n\
188 Decimal('-Infinity')\n\ 493 Decimal('-Infinity')\n\
189 \n\ 494 \n\
190 \n"); 495 \n");
191 496
192 PyDoc_STRVAR(doc_fma, 497 PyDoc_STRVAR(doc_fma,
193 "fma($self, /, other, third, context=None)\n--\n\n\ 498 "fma($self, /, other, third, context=None)\n--\n\n\
194 Fused multiply-add. Return self*other+third with no rounding of the\n\ 499 Returns a multiplied by b, plus c.\n\
195 intermediate product self*other.\n\ 500 \n\
196 \n\ 501 Fused multiply-add. The first two operands are multiplied together,\n\
197 >>> Decimal(2).fma(3, 5)\n\ 502 using multiply, the third operand is then added to the result of that\n\
198 Decimal('11')\n\ 503 multiplication, using add, all with only one final rounding.\n\
199 \n\ 504 \n\
505 >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))\n\
506 Decimal('22')\n\
507 >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))\n\
508 Decimal('-8')\n\
509 >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal ('-86087.7578'))\n\
510 Decimal('1.38435736E+12')\n\
511 >>> ExtendedContext.fma(1, 3, 4)\n\
512 Decimal('7')\n\
513 >>> ExtendedContext.fma(1, Decimal(3), 4)\n\
514 Decimal('7')\n\
515 >>> ExtendedContext.fma(1, 3, Decimal(4))\n\
516 Decimal('7')\n\
200 \n"); 517 \n");
201 518
202 PyDoc_STRVAR(doc_is_canonical, 519 PyDoc_STRVAR(doc_is_canonical,
203 "is_canonical($self, /)\n--\n\n\ 520 "is_canonical($self, /)\n--\n\n\
204 Return True if the argument is canonical and False otherwise. Currently,\n\ 521 Return True if the operand is canonical; otherwise return False.\n\
205 a Decimal instance is always canonical, so this operation always returns\n\ 522 Currently, the encoding of a Decimal instance is always\n\
206 True.\n\ 523 canonical, so this method returns True for any Decimal.\n\
524 \n\
525 >>> ExtendedContext.is_canonical(Decimal('2.50'))\n\
526 True\n\
207 \n"); 527 \n");
208 528
209 PyDoc_STRVAR(doc_is_finite, 529 PyDoc_STRVAR(doc_is_finite,
210 "is_finite($self, /)\n--\n\n\ 530 "is_finite($self, /)\n--\n\n\
211 Return True if the argument is a finite number, and False if the argument\n\ 531 Return True if the operand is finite; otherwise return False.\n\
212 is infinite or a NaN.\n\ 532 A Decimal instance is considered finite if it is neither infinite nor a\n\
533 NaN.\n\
534 \n\
535 >>> ExtendedContext.is_finite(Decimal('2.50'))\n\
536 True\n\
537 >>> ExtendedContext.is_finite(Decimal('-0.3'))\n\
538 True\n\
539 >>> ExtendedContext.is_finite(Decimal('0'))\n\
540 True\n\
541 >>> ExtendedContext.is_finite(Decimal('Inf'))\n\
542 False\n\
543 >>> ExtendedContext.is_finite(Decimal('NaN'))\n\
544 False\n\
545 >>> ExtendedContext.is_finite(1)\n\
546 True\n\
213 \n"); 547 \n");
214 548
215 PyDoc_STRVAR(doc_is_infinite, 549 PyDoc_STRVAR(doc_is_infinite,
216 "is_infinite($self, /)\n--\n\n\ 550 "is_infinite($self, /)\n--\n\n\
217 Return True if the argument is either positive or negative infinity and\n\ 551 Return True if the operand is infinite; otherwise return False.\n\
218 False otherwise.\n\ 552 \n\
553 >>> ExtendedContext.is_infinite(Decimal('2.50'))\n\
554 False\n\
555 >>> ExtendedContext.is_infinite(Decimal('-Inf'))\n\
556 True\n\
557 >>> ExtendedContext.is_infinite(Decimal('NaN'))\n\
558 False\n\
559 >>> ExtendedContext.is_infinite(1)\n\
560 False\n\
219 \n"); 561 \n");
220 562
221 PyDoc_STRVAR(doc_is_nan, 563 PyDoc_STRVAR(doc_is_nan,
222 "is_nan($self, /)\n--\n\n\ 564 "is_nan($self, /)\n--\n\n\
223 Return True if the argument is a (quiet or signaling) NaN and False\n\ 565 Return True if the operand is a (quiet or signaling) NaN or NaN;\n\
224 otherwise.\n\ 566 otherwise return False.\n\
567 \n\
568 >>> ExtendedContext.is_nan(Decimal('2.50'))\n\
569 False\n\
570 >>> ExtendedContext.is_nan(Decimal('NaN'))\n\
571 True\n\
572 >>> ExtendedContext.is_nan(Decimal('-sNaN'))\n\
573 True\n\
574 >>> ExtendedContext.is_nan(1)\n\
575 False\n\
225 \n"); 576 \n");
226 577
227 PyDoc_STRVAR(doc_is_normal, 578 PyDoc_STRVAR(doc_is_normal,
228 "is_normal($self, /, context=None)\n--\n\n\ 579 "is_normal($self, /, context=None)\n--\n\n\
229 Return True if the argument is a normal finite non-zero number with an\n\ 580 Return True if the operand is a normal number; otherwise return False.\n\
230 adjusted exponent greater than or equal to Emin. Return False if the\n\ 581 \n\
231 argument is zero, subnormal, infinite or a NaN.\n\ 582 >>> c = ExtendedContext.copy()\n\
583 >>> c.Emin = -999\n\
584 >>> c.Emax = 999\n\
585 >>> c.is_normal(Decimal('2.50'))\n\
586 True\n\
587 >>> c.is_normal(Decimal('0.1E-999'))\n\
588 False\n\
589 >>> c.is_normal(Decimal('0.00'))\n\
590 False\n\
591 >>> c.is_normal(Decimal('-Inf'))\n\
592 False\n\
593 >>> c.is_normal(Decimal('NaN'))\n\
594 False\n\
595 >>> c.is_normal(1)\n\
596 True\n\
232 \n"); 597 \n");
233 598
234 PyDoc_STRVAR(doc_is_qnan, 599 PyDoc_STRVAR(doc_is_qnan,
235 "is_qnan($self, /)\n--\n\n\ 600 "is_qnan($self, /)\n--\n\n\
236 Return True if the argument is a quiet NaN, and False otherwise.\n\ 601 Return True if the argument is a quiet NaN; otherwise return False.\n\
602 \n\
603 >>> ExtendedContext.is_qnan(Decimal('2.50'))\n\
604 False\n\
605 >>> ExtendedContext.is_qnan(Decimal('NaN'))\n\
606 True\n\
607 >>> ExtendedContext.is_qnan(Decimal('sNaN'))\n\
608 False\n\
609 >>> ExtendedContext.is_qnan(1)\n\
610 False\n\
237 \n"); 611 \n");
238 612
239 PyDoc_STRVAR(doc_is_signed, 613 PyDoc_STRVAR(doc_is_signed,
240 "is_signed($self, /)\n--\n\n\ 614 "is_signed($self, /)\n--\n\n\
241 Return True if the argument has a negative sign and False otherwise.\n\ 615 Return True if the argument has a negative sign and False otherwise.\n\
242 Note that both zeros and NaNs can carry signs.\n\ 616 Note that both zeros and NaNs can carry signs.\n\
617 \n\
618 >>> ExtendedContext.is_signed(Decimal('2.50'))\n\
619 False\n\
620 >>> ExtendedContext.is_signed(Decimal('-12'))\n\
621 True\n\
622 >>> ExtendedContext.is_signed(Decimal('-0'))\n\
623 True\n\
624 >>> ExtendedContext.is_signed(8)\n\
625 False\n\
626 >>> ExtendedContext.is_signed(-8)\n\
627 True\n\
243 \n"); 628 \n");
244 629
245 PyDoc_STRVAR(doc_is_snan, 630 PyDoc_STRVAR(doc_is_snan,
246 "is_snan($self, /)\n--\n\n\ 631 "is_snan($self, /)\n--\n\n\
247 Return True if the argument is a signaling NaN and False otherwise.\n\ 632 Return True if the operand is a signaling NaN; otherwise return False.\n\
633 \n\
634 >>> ExtendedContext.is_snan(Decimal('2.50'))\n\
635 False\n\
636 >>> ExtendedContext.is_snan(Decimal('NaN'))\n\
637 False\n\
638 >>> ExtendedContext.is_snan(Decimal('sNaN'))\n\
639 True\n\
640 >>> ExtendedContext.is_snan(1)\n\
641 False\n\
248 \n"); 642 \n");
249 643
250 PyDoc_STRVAR(doc_is_subnormal, 644 PyDoc_STRVAR(doc_is_subnormal,
251 "is_subnormal($self, /, context=None)\n--\n\n\ 645 "is_subnormal($self, /, context=None)\n--\n\n\
252 Return True if the argument is subnormal, and False otherwise. A number is\n\ 646 Return True if the argument is subnormal; otherwise return False. A number\n\
253 subnormal if it is non-zero, finite, and has an adjusted exponent less\n\ 647 is subnormal if it is non-zero, finite, and has an adjusted exponent less\n\
254 than Emin.\n\ 648 than Emin.\n\
649 \n\
650 >>> c = ExtendedContext.copy()\n\
651 >>> c.Emin = -999\n\
652 >>> c.Emax = 999\n\
653 >>> c.is_subnormal(Decimal('2.50'))\n\
654 False\n\
655 >>> c.is_subnormal(Decimal('0.1E-999'))\n\
656 True\n\
657 >>> c.is_subnormal(Decimal('0.00'))\n\
658 False\n\
659 >>> c.is_subnormal(Decimal('-Inf'))\n\
660 False\n\
661 >>> c.is_subnormal(Decimal('NaN'))\n\
662 False\n\
663 >>> c.is_subnormal(1)\n\
664 False\n\
255 \n"); 665 \n");
256 666
257 PyDoc_STRVAR(doc_is_zero, 667 PyDoc_STRVAR(doc_is_zero,
258 "is_zero($self, /)\n--\n\n\ 668 "is_zero($self, /)\n--\n\n\
259 Return True if the argument is a (positive or negative) zero and False\n\ 669 Return True if the operand is a zero; otherwise return False.\n\
260 otherwise.\n\ 670 \n\
671 >>> ExtendedContext.is_zero(Decimal('0'))\n\
672 True\n\
673 >>> ExtendedContext.is_zero(Decimal('2.50'))\n\
674 False\n\
675 >>> ExtendedContext.is_zero(Decimal('-0E+2'))\n\
676 True\n\
677 >>> ExtendedContext.is_zero(1)\n\
678 False\n\
679 >>> ExtendedContext.is_zero(0)\n\
680 True\n\
261 \n"); 681 \n");
262 682
263 PyDoc_STRVAR(doc_ln, 683 PyDoc_STRVAR(doc_ln,
264 "ln($self, /, context=None)\n--\n\n\ 684 "ln($self, /, context=None)\n--\n\n\
265 Return the natural (base e) logarithm of the operand. The function always\n\ 685 Return the natural (base e) logarithm of the operand. The function always\n\
266 uses the ROUND_HALF_EVEN mode and the result is correctly rounded.\n\ 686 uses the ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
687 \n\
688 >>> c = ExtendedContext.copy()\n\
689 >>> c.Emin = -999\n\
690 >>> c.Emax = 999\n\
691 >>> c.ln(Decimal('0'))\n\
692 Decimal('-Infinity')\n\
693 >>> c.ln(Decimal('1.000'))\n\
694 Decimal('0')\n\
695 >>> c.ln(Decimal('2.71828183'))\n\
696 Decimal('1.00000000')\n\
697 >>> c.ln(Decimal('10'))\n\
698 Decimal('2.30258509')\n\
699 >>> c.ln(Decimal('+Infinity'))\n\
700 Decimal('Infinity')\n\
701 >>> c.ln(1)\n\
702 Decimal('0')\n\
267 \n"); 703 \n");
268 704
269 PyDoc_STRVAR(doc_log10, 705 PyDoc_STRVAR(doc_log10,
270 "log10($self, /, context=None)\n--\n\n\ 706 "log10($self, /, context=None)\n--\n\n\
271 Return the base ten logarithm of the operand. The function always uses the\n\ 707 Return the base 10 logarithm of the operand. The function always uses the\n\
272 ROUND_HALF_EVEN mode and the result is correctly rounded.\n\ 708 ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
709 \n\
710 >>> c = ExtendedContext.copy()\n\
711 >>> c.Emin = -999\n\
712 >>> c.Emax = 999\n\
713 >>> c.log10(Decimal('0'))\n\
714 Decimal('-Infinity')\n\
715 >>> c.log10(Decimal('0.001'))\n\
716 Decimal('-3')\n\
717 >>> c.log10(Decimal('1.000'))\n\
718 Decimal('0')\n\
719 >>> c.log10(Decimal('2'))\n\
720 Decimal('0.301029996')\n\
721 >>> c.log10(Decimal('10'))\n\
722 Decimal('1')\n\
723 >>> c.log10(Decimal('70'))\n\
724 Decimal('1.84509804')\n\
725 >>> c.log10(Decimal('+Infinity'))\n\
726 Decimal('Infinity')\n\
727 >>> c.log10(0)\n\
728 Decimal('-Infinity')\n\
729 >>> c.log10(1)\n\
730 Decimal('0')\n\
273 \n"); 731 \n");
274 732
275 PyDoc_STRVAR(doc_logb, 733 PyDoc_STRVAR(doc_logb,
276 "logb($self, /, context=None)\n--\n\n\ 734 "logb($self, /, context=None)\n--\n\n\
277 For a non-zero number, return the adjusted exponent of the operand as a\n\ 735 Returns the exponent of the magnitude of the operand's MSD.\n\
278 Decimal instance. If the operand is a zero, then Decimal('-Infinity') is\n\ 736 The result is the integer which is the exponent of the magnitude\n\
279 returned and the DivisionByZero condition is raised. If the operand is\n\ 737 of the most significant digit of the operand (as though the\n\
280 an infinity then Decimal('Infinity') is returned.\n\ 738 operand were truncated to a single digit while maintaining the\n\
739 value of that digit and without limiting the resulting exponent).\n\
skrah 2016/10/23 21:39:46 Personally, I have a hard time understanding this
lisroach 2016/12/01 22:44:42 I agree this is confusing. It is taken directly fr
740 \n\
741 >>> ExtendedContext.logb(Decimal('250'))\n\
742 Decimal('2')\n\
743 >>> ExtendedContext.logb(Decimal('2.50'))\n\
744 Decimal('0')\n\
745 >>> ExtendedContext.logb(Decimal('0.03'))\n\
746 Decimal('-2')\n\
747 >>> ExtendedContext.logb(Decimal('0'))\n\
748 Decimal('-Infinity')\n\
749 >>> ExtendedContext.logb(1)\n\
750 Decimal('0')\n\
751 >>> ExtendedContext.logb(10)\n\
752 Decimal('1')\n\
753 >>> ExtendedContext.logb(100)\n\
754 Decimal('2')\n\
281 \n"); 755 \n");
282 756
283 PyDoc_STRVAR(doc_logical_and, 757 PyDoc_STRVAR(doc_logical_and,
284 "logical_and($self, /, other, context=None)\n--\n\n\ 758 "logical_and($self, /, other, context=None)\n--\n\n\
285 Return the digit-wise 'and' of the two (logical) operands.\n\ 759 Applies the logical operation 'and' between each operand's digits.\n\
760 The operands must be both logical numbers.\n\
761 \n\
762 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))\n\
763 Decimal('0')\n\
764 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))\n\
765 Decimal('0')\n\
766 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))\n\
767 Decimal('0')\n\
768 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))\n\
769 Decimal('1')\n\
770 >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))\n\
771 Decimal('1000')\n\
772 >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))\n\
773 Decimal('10')\n\
774 >>> ExtendedContext.logical_and(110, 1101)\n\
775 Decimal('100')\n\
776 >>> ExtendedContext.logical_and(Decimal(110), 1101)\n\
777 Decimal('100')\n\
778 >>> ExtendedContext.logical_and(110, Decimal(1101))\n\
779 Decimal('100')\n\
286 \n"); 780 \n");
287 781
288 PyDoc_STRVAR(doc_logical_invert, 782 PyDoc_STRVAR(doc_logical_invert,
289 "logical_invert($self, /, context=None)\n--\n\n\ 783 "logical_invert($self, /, context=None)\n--\n\n\
290 Return the digit-wise inversion of the (logical) operand.\n\ 784 Invert all the digits in the operand.\n\
785 The operand must be a logical number.\n\
786 \n\
787 >>> ExtendedContext.logical_invert(Decimal('0'))\n\
788 Decimal('111111111')\n\
789 >>> ExtendedContext.logical_invert(Decimal('1'))\n\
790 Decimal('111111110')\n\
791 >>> ExtendedContext.logical_invert(Decimal('111111111'))\n\
792 Decimal('0')\n\
793 >>> ExtendedContext.logical_invert(Decimal('101010101'))\n\
794 Decimal('10101010')\n\
795 >>> ExtendedContext.logical_invert(1101)\n\
796 Decimal('111110010')\n\
291 \n"); 797 \n");
292 798
293 PyDoc_STRVAR(doc_logical_or, 799 PyDoc_STRVAR(doc_logical_or,
294 "logical_or($self, /, other, context=None)\n--\n\n\ 800 "logical_or($self, /, other, context=None)\n--\n\n\
295 Return the digit-wise 'or' of the two (logical) operands.\n\ 801 Return the digit-wise 'or' of the two (logical) operands.\n\
296 \n"); 802 \n");
297 803
298 PyDoc_STRVAR(doc_logical_xor, 804 PyDoc_STRVAR(doc_logical_xor,
299 "logical_xor($self, /, other, context=None)\n--\n\n\ 805 "logical_xor($self, /, other, context=None)\n--\n\n\
300 Return the digit-wise 'exclusive or' of the two (logical) operands.\n\ 806 Return the digit-wise 'exclusive or' of the two (logical) operands.\n\
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 Round to an integer.\n\ 1378 Round to an integer.\n\
873 \n"); 1379 \n");
874 1380
875 PyDoc_STRVAR(doc_ctx_to_sci_string, 1381 PyDoc_STRVAR(doc_ctx_to_sci_string,
876 "to_sci_string($self, x, /)\n--\n\n\ 1382 "to_sci_string($self, x, /)\n--\n\n\
877 Convert a number to a string using scientific notation.\n\ 1383 Convert a number to a string using scientific notation.\n\
878 \n"); 1384 \n");
879 1385
880 1386
881 #endif /* DOCSTRINGS_H */ 1387 #endif /* DOCSTRINGS_H */
882
883
884
OLDNEW
« no previous file with comments | « Lib/_pydecimal.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+