Debian Codegraph @

Modules/_decimal/docstrings.h

raw
1 /*
2 * Copyright (c) 2001-2012 Python Software Foundation. All Rights Reserved.
3 * Modified and extended by Stefan Krah.
4 */
5
6
7 #ifndef DOCSTRINGS_H
8 #define DOCSTRINGS_H
9
10
11 #include "pymacro.h"
12
13
14 /******************************************************************************/
15 /* Module */
16 /******************************************************************************/
17
18
19 PyDoc_STRVAR(doc__decimal,
20 "C decimal arithmetic module");
21
22 PyDoc_STRVAR(doc_getcontext,
23 "getcontext($module, /)\n--\n\n\
24 Get the current default context.\n\
25 \n");
26
27 PyDoc_STRVAR(doc_setcontext,
28 "setcontext($module, context, /)\n--\n\n\
29 Set a new default context.\n\
30 \n");
31
32 PyDoc_STRVAR(doc_localcontext,
33 "localcontext($module, /, ctx=None, **kwargs)\n--\n\n\
34 Return a context manager that will set the default context to a copy of ctx\n\
35 on entry to the with-statement and restore the previous default context when\n\
36 exiting the with-statement. If no context is specified, a copy of the current\n\
37 default context is used.\n\
38 \n");
39
40 #ifdef EXTRA_FUNCTIONALITY
41 PyDoc_STRVAR(doc_ieee_context,
42 "IEEEContext($module, bits, /)\n--\n\n\
43 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\
45 than IEEE_CONTEXT_MAX_BITS. For the most common values, the constants\n\
46 DECIMAL32, DECIMAL64 and DECIMAL128 are provided.\n\
47 \n");
48 #endif
49
50
51 /******************************************************************************/
52 /* Decimal Object and Methods */
53 /******************************************************************************/
54
55 PyDoc_STRVAR(doc_decimal,
56 "Decimal(value=\"0\", context=None)\n--\n\n\
57 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\
59 context does not affect the conversion and is only passed to determine if\n\
60 the InvalidOperation trap is active.\n\
61 \n");
62
63 PyDoc_STRVAR(doc_adjusted,
64 "adjusted($self, /)\n--\n\n\
65 Return the adjusted exponent of the number. Defined as exp + digits - 1.\n\
66 \n");
67
68 PyDoc_STRVAR(doc_as_tuple,
69 "as_tuple($self, /)\n--\n\n\
70 Return a tuple representation of the number.\n\
71 \n");
72
73 PyDoc_STRVAR(doc_as_integer_ratio,
74 "as_integer_ratio($self, /)\n--\n\n\
75 Decimal.as_integer_ratio() -> (int, int)\n\
76 \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\
79 Raise OverflowError on infinities and a ValueError on NaNs.\n\
80 \n");
81
82 PyDoc_STRVAR(doc_canonical,
83 "canonical($self, /)\n--\n\n\
84 Return the canonical encoding of the argument. Currently, the encoding\n\
85 of a Decimal instance is always canonical, so this operation returns its\n\
86 argument unchanged.\n\
87 \n");
88
89 PyDoc_STRVAR(doc_compare,
90 "compare($self, /, other, context=None)\n--\n\n\
91 Compare self to other. Return a decimal value:\n\
92 \n\
93 a or b is a NaN ==> Decimal('NaN')\n\
94 a < b ==> Decimal('-1')\n\
95 a == b ==> Decimal('0')\n\
96 a > b ==> Decimal('1')\n\
97 \n");
98
99 PyDoc_STRVAR(doc_compare_signal,
100 "compare_signal($self, /, other, context=None)\n--\n\n\
101 Identical to compare, except that all NaNs signal.\n\
102 \n");
103
104 PyDoc_STRVAR(doc_compare_total,
105 "compare_total($self, /, other, context=None)\n--\n\n\
106 Compare two operands using their abstract representation rather than\n\
107 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\
109 the same numeric value but different representations compare unequal\n\
110 in this ordering:\n\
111 \n\
112 >>> Decimal('12.0').compare_total(Decimal('12'))\n\
113 Decimal('-1')\n\
114 \n\
115 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\
117 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\
119 second operand. See the specification for details of the total order.\n\
120 \n\
121 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\
123 InvalidOperation if the second operand cannot be converted exactly.\n\
124 \n");
125
126 PyDoc_STRVAR(doc_compare_total_mag,
127 "compare_total_mag($self, /, other, context=None)\n--\n\n\
128 Compare two operands using their abstract representation rather than their\n\
129 value as in compare_total(), but ignoring the sign of each operand.\n\
130 \n\
131 x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()).\n\
132 \n\
133 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\
135 InvalidOperation if the second operand cannot be converted exactly.\n\
136 \n");
137
138 PyDoc_STRVAR(doc_conjugate,
139 "conjugate($self, /)\n--\n\n\
140 Return self.\n\
141 \n");
142
143 PyDoc_STRVAR(doc_copy_abs,
144 "copy_abs($self, /)\n--\n\n\
145 Return the absolute value of the argument. This operation is unaffected by\n\
146 context and is quiet: no flags are changed and no rounding is performed.\n\
147 \n");
148
149 PyDoc_STRVAR(doc_copy_negate,
150 "copy_negate($self, /)\n--\n\n\
151 Return the negation of the argument. This operation is unaffected by context\n\
152 and is quiet: no flags are changed and no rounding is performed.\n\
153 \n");
154
155 PyDoc_STRVAR(doc_copy_sign,
156 "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\
158 sign of the second operand. For example:\n\
159 \n\
160 >>> Decimal('2.3').copy_sign(Decimal('-1.5'))\n\
161 Decimal('-2.3')\n\
162 \n\
163 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\
165 InvalidOperation if the second operand cannot be converted exactly.\n\
166 \n");
167
168 PyDoc_STRVAR(doc_exp,
169 "exp($self, /, context=None)\n--\n\n\
170 Return the value of the (natural) exponential function e**x at the given\n\
171 number. The function always uses the ROUND_HALF_EVEN mode and the result\n\
172 is correctly rounded.\n\
173 \n");
174
175 PyDoc_STRVAR(doc_from_float,
176 "from_float($type, f, /)\n--\n\n\
177 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\
179 Decimal.from_float(0.1) is not the same as Decimal('0.1').\n\
180 \n\
181 >>> Decimal.from_float(0.1)\n\
182 Decimal('0.1000000000000000055511151231257827021181583404541015625')\n\
183 >>> Decimal.from_float(float('nan'))\n\
184 Decimal('NaN')\n\
185 >>> Decimal.from_float(float('inf'))\n\
186 Decimal('Infinity')\n\
187 >>> Decimal.from_float(float('-inf'))\n\
188 Decimal('-Infinity')\n\
189 \n\
190 \n");
191
192 PyDoc_STRVAR(doc_fma,
193 "fma($self, /, other, third, context=None)\n--\n\n\
194 Fused multiply-add. Return self*other+third with no rounding of the\n\
195 intermediate product self*other.\n\
196 \n\
197 >>> Decimal(2).fma(3, 5)\n\
198 Decimal('11')\n\
199 \n\
200 \n");
201
202 PyDoc_STRVAR(doc_is_canonical,
203 "is_canonical($self, /)\n--\n\n\
204 Return True if the argument is canonical and False otherwise. Currently,\n\
205 a Decimal instance is always canonical, so this operation always returns\n\
206 True.\n\
207 \n");
208
209 PyDoc_STRVAR(doc_is_finite,
210 "is_finite($self, /)\n--\n\n\
211 Return True if the argument is a finite number, and False if the argument\n\
212 is infinite or a NaN.\n\
213 \n");
214
215 PyDoc_STRVAR(doc_is_infinite,
216 "is_infinite($self, /)\n--\n\n\
217 Return True if the argument is either positive or negative infinity and\n\
218 False otherwise.\n\
219 \n");
220
221 PyDoc_STRVAR(doc_is_nan,
222 "is_nan($self, /)\n--\n\n\
223 Return True if the argument is a (quiet or signaling) NaN and False\n\
224 otherwise.\n\
225 \n");
226
227 PyDoc_STRVAR(doc_is_normal,
228 "is_normal($self, /, context=None)\n--\n\n\
229 Return True if the argument is a normal finite non-zero number with an\n\
230 adjusted exponent greater than or equal to Emin. Return False if the\n\
231 argument is zero, subnormal, infinite or a NaN.\n\
232 \n");
233
234 PyDoc_STRVAR(doc_is_qnan,
235 "is_qnan($self, /)\n--\n\n\
236 Return True if the argument is a quiet NaN, and False otherwise.\n\
237 \n");
238
239 PyDoc_STRVAR(doc_is_signed,
240 "is_signed($self, /)\n--\n\n\
241 Return True if the argument has a negative sign and False otherwise.\n\
242 Note that both zeros and NaNs can carry signs.\n\
243 \n");
244
245 PyDoc_STRVAR(doc_is_snan,
246 "is_snan($self, /)\n--\n\n\
247 Return True if the argument is a signaling NaN and False otherwise.\n\
248 \n");
249
250 PyDoc_STRVAR(doc_is_subnormal,
251 "is_subnormal($self, /, context=None)\n--\n\n\
252 Return True if the argument is subnormal, and False otherwise. A number is\n\
253 subnormal if it is non-zero, finite, and has an adjusted exponent less\n\
254 than Emin.\n\
255 \n");
256
257 PyDoc_STRVAR(doc_is_zero,
258 "is_zero($self, /)\n--\n\n\
259 Return True if the argument is a (positive or negative) zero and False\n\
260 otherwise.\n\
261 \n");
262
263 PyDoc_STRVAR(doc_ln,
264 "ln($self, /, context=None)\n--\n\n\
265 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\
267 \n");
268
269 PyDoc_STRVAR(doc_log10,
270 "log10($self, /, context=None)\n--\n\n\
271 Return the base ten logarithm of the operand. The function always uses the\n\
272 ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
273 \n");
274
275 PyDoc_STRVAR(doc_logb,
276 "logb($self, /, context=None)\n--\n\n\
277 For a non-zero number, return the adjusted exponent of the operand as a\n\
278 Decimal instance. If the operand is a zero, then Decimal('-Infinity') is\n\
279 returned and the DivisionByZero condition is raised. If the operand is\n\
280 an infinity then Decimal('Infinity') is returned.\n\
281 \n");
282
283 PyDoc_STRVAR(doc_logical_and,
284 "logical_and($self, /, other, context=None)\n--\n\n\
285 Applies an 'and' operation between self and other's digits.\n\n\
286 Both self and other must be logical numbers.\n\
287 \n");
288
289 PyDoc_STRVAR(doc_logical_invert,
290 "logical_invert($self, /, context=None)\n--\n\n\
291 Invert all its digits.\n\n\
292 The self must be logical number.\n\
293 \n");
294
295 PyDoc_STRVAR(doc_logical_or,
296 "logical_or($self, /, other, context=None)\n--\n\n\
297 Applies an 'or' operation between self and other's digits.\n\n\
298 Both self and other must be logical numbers. \n\
299 \n");
300
301 PyDoc_STRVAR(doc_logical_xor,
302 "logical_xor($self, /, other, context=None)\n--\n\n\
303 Applies an 'xor' operation between self and other's digits.\n\n\
304 Both self and other must be logical numbers.\n\
305 \n");
306
307 PyDoc_STRVAR(doc_max,
308 "max($self, /, other, context=None)\n--\n\n\
309 Maximum of self and other. If one operand is a quiet NaN and the other is\n\
310 numeric, the numeric operand is returned.\n\
311 \n");
312
313 PyDoc_STRVAR(doc_max_mag,
314 "max_mag($self, /, other, context=None)\n--\n\n\
315 Similar to the max() method, but the comparison is done using the absolute\n\
316 values of the operands.\n\
317 \n");
318
319 PyDoc_STRVAR(doc_min,
320 "min($self, /, other, context=None)\n--\n\n\
321 Minimum of self and other. If one operand is a quiet NaN and the other is\n\
322 numeric, the numeric operand is returned.\n\
323 \n");
324
325 PyDoc_STRVAR(doc_min_mag,
326 "min_mag($self, /, other, context=None)\n--\n\n\
327 Similar to the min() method, but the comparison is done using the absolute\n\
328 values of the operands.\n\
329 \n");
330
331 PyDoc_STRVAR(doc_next_minus,
332 "next_minus($self, /, context=None)\n--\n\n\
333 Return the largest number representable in the given context (or in the\n\
334 current default context if no context is given) that is smaller than the\n\
335 given operand.\n\
336 \n");
337
338 PyDoc_STRVAR(doc_next_plus,
339 "next_plus($self, /, context=None)\n--\n\n\
340 Return the smallest number representable in the given context (or in the\n\
341 current default context if no context is given) that is larger than the\n\
342 given operand.\n\
343 \n");
344
345 PyDoc_STRVAR(doc_next_toward,
346 "next_toward($self, /, other, context=None)\n--\n\n\
347 If the two operands are unequal, return the number closest to the first\n\
348 operand in the direction of the second operand. If both operands are\n\
349 numerically equal, return a copy of the first operand with the sign set\n\
350 to be the same as the sign of the second operand.\n\
351 \n");
352
353 PyDoc_STRVAR(doc_normalize,
354 "normalize($self, /, context=None)\n--\n\n\
355 Normalize the number by stripping the rightmost trailing zeros and\n\
356 converting any result equal to Decimal('0') to Decimal('0e0'). Used\n\
357 for producing canonical values for members of an equivalence class.\n\
358 For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize\n\
359 to the equivalent value Decimal('32.1').\n\
360 \n");
361
362 PyDoc_STRVAR(doc_number_class,
363 "number_class($self, /, context=None)\n--\n\n\
364 Return a string describing the class of the operand. The returned value\n\
365 is one of the following ten strings:\n\
366 \n\
367 * '-Infinity', indicating that the operand is negative infinity.\n\
368 * '-Normal', indicating that the operand is a negative normal number.\n\
369 * '-Subnormal', indicating that the operand is negative and subnormal.\n\
370 * '-Zero', indicating that the operand is a negative zero.\n\
371 * '+Zero', indicating that the operand is a positive zero.\n\
372 * '+Subnormal', indicating that the operand is positive and subnormal.\n\
373 * '+Normal', indicating that the operand is a positive normal number.\n\
374 * '+Infinity', indicating that the operand is positive infinity.\n\
375 * 'NaN', indicating that the operand is a quiet NaN (Not a Number).\n\
376 * 'sNaN', indicating that the operand is a signaling NaN.\n\
377 \n\
378 \n");
379
380 PyDoc_STRVAR(doc_quantize,
381 "quantize($self, /, exp, rounding=None, context=None)\n--\n\n\
382 Return a value equal to the first operand after rounding and having the\n\
383 exponent of the second operand.\n\
384 \n\
385 >>> Decimal('1.41421356').quantize(Decimal('1.000'))\n\
386 Decimal('1.414')\n\
387 \n\
388 Unlike other operations, if the length of the coefficient after the quantize\n\
389 operation would be greater than precision, then an InvalidOperation is signaled.\n\
390 This guarantees that, unless there is an error condition, the quantized exponent\n\
391 is always equal to that of the right-hand operand.\n\
392 \n\
393 Also unlike other operations, quantize never signals Underflow, even if the\n\
394 result is subnormal and inexact.\n\
395 \n\
396 If the exponent of the second operand is larger than that of the first, then\n\
397 rounding may be necessary. In this case, the rounding mode is determined by the\n\
398 rounding argument if given, else by the given context argument; if neither\n\
399 argument is given, the rounding mode of the current thread's context is used.\n\
400 \n");
401
402 PyDoc_STRVAR(doc_radix,
403 "radix($self, /)\n--\n\n\
404 Return Decimal(10), the radix (base) in which the Decimal class does\n\
405 all its arithmetic. Included for compatibility with the specification.\n\
406 \n");
407
408 PyDoc_STRVAR(doc_remainder_near,
409 "remainder_near($self, /, other, context=None)\n--\n\n\
410 Return the remainder from dividing self by other. This differs from\n\
411 self % other in that the sign of the remainder is chosen so as to minimize\n\
412 its absolute value. More precisely, the return value is self - n * other\n\
413 where n is the integer nearest to the exact value of self / other, and\n\
414 if two integers are equally near then the even one is chosen.\n\
415 \n\
416 If the result is zero then its sign will be the sign of self.\n\
417 \n");
418
419 PyDoc_STRVAR(doc_rotate,
420 "rotate($self, /, other, context=None)\n--\n\n\
421 Return the result of rotating the digits of the first operand by an amount\n\
422 specified by the second operand. The second operand must be an integer in\n\
423 the range -precision through precision. The absolute value of the second\n\
424 operand gives the number of places to rotate. If the second operand is\n\
425 positive then rotation is to the left; otherwise rotation is to the right.\n\
426 The coefficient of the first operand is padded on the left with zeros to\n\
427 length precision if necessary. The sign and exponent of the first operand are\n\
428 unchanged.\n\
429 \n");
430
431 PyDoc_STRVAR(doc_same_quantum,
432 "same_quantum($self, /, other, context=None)\n--\n\n\
433 Test whether self and other have the same exponent or whether both are NaN.\n\
434 \n\
435 This operation is unaffected by context and is quiet: no flags are changed\n\
436 and no rounding is performed. As an exception, the C version may raise\n\
437 InvalidOperation if the second operand cannot be converted exactly.\n\
438 \n");
439
440 PyDoc_STRVAR(doc_scaleb,
441 "scaleb($self, /, other, context=None)\n--\n\n\
442 Return the first operand with the exponent adjusted the second. Equivalently,\n\
443 return the first operand multiplied by 10**other. The second operand must be\n\
444 an integer.\n\
445 \n");
446
447 PyDoc_STRVAR(doc_shift,
448 "shift($self, /, other, context=None)\n--\n\n\
449 Return the result of shifting the digits of the first operand by an amount\n\
450 specified by the second operand. The second operand must be an integer in\n\
451 the range -precision through precision. The absolute value of the second\n\
452 operand gives the number of places to shift. If the second operand is\n\
453 positive, then the shift is to the left; otherwise the shift is to the\n\
454 right. Digits shifted into the coefficient are zeros. The sign and exponent\n\
455 of the first operand are unchanged.\n\
456 \n");
457
458 PyDoc_STRVAR(doc_sqrt,
459 "sqrt($self, /, context=None)\n--\n\n\
460 Return the square root of the argument to full precision. The result is\n\
461 correctly rounded using the ROUND_HALF_EVEN rounding mode.\n\
462 \n");
463
464 PyDoc_STRVAR(doc_to_eng_string,
465 "to_eng_string($self, /, context=None)\n--\n\n\
466 Convert to an engineering-type string. Engineering notation has an exponent\n\
467 which is a multiple of 3, so there are up to 3 digits left of the decimal\n\
468 place. For example, Decimal('123E+1') is converted to Decimal('1.23E+3').\n\
469 \n\
470 The value of context.capitals determines whether the exponent sign is lower\n\
471 or upper case. Otherwise, the context does not affect the operation.\n\
472 \n");
473
474 PyDoc_STRVAR(doc_to_integral,
475 "to_integral($self, /, rounding=None, context=None)\n--\n\n\
476 Identical to the to_integral_value() method. The to_integral() name has been\n\
477 kept for compatibility with older versions.\n\
478 \n");
479
480 PyDoc_STRVAR(doc_to_integral_exact,
481 "to_integral_exact($self, /, rounding=None, context=None)\n--\n\n\
482 Round to the nearest integer, signaling Inexact or Rounded as appropriate if\n\
483 rounding occurs. The rounding mode is determined by the rounding parameter\n\
484 if given, else by the given context. If neither parameter is given, then the\n\
485 rounding mode of the current default context is used.\n\
486 \n");
487
488 PyDoc_STRVAR(doc_to_integral_value,
489 "to_integral_value($self, /, rounding=None, context=None)\n--\n\n\
490 Round to the nearest integer without signaling Inexact or Rounded. The\n\
491 rounding mode is determined by the rounding parameter if given, else by\n\
492 the given context. If neither parameter is given, then the rounding mode\n\
493 of the current default context is used.\n\
494 \n");
495
496
497 /******************************************************************************/
498 /* Context Object and Methods */
499 /******************************************************************************/
500
501 PyDoc_STRVAR(doc_context,
502 "Context(prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None)\n--\n\n\
503 The context affects almost all operations and controls rounding,\n\
504 Over/Underflow, raising of exceptions and much more. A new context\n\
505 can be constructed as follows:\n\
506 \n\
507 >>> c = Context(prec=28, Emin=-425000000, Emax=425000000,\n\
508 ... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,\n\
509 ... traps=[InvalidOperation, DivisionByZero, Overflow],\n\
510 ... flags=[])\n\
511 >>>\n\
512 \n\
513 \n");
514
515 #ifdef EXTRA_FUNCTIONALITY
516 PyDoc_STRVAR(doc_ctx_apply,
517 "apply($self, x, /)\n--\n\n\
518 Apply self to Decimal x.\n\
519 \n");
520 #endif
521
522 PyDoc_STRVAR(doc_ctx_clear_flags,
523 "clear_flags($self, /)\n--\n\n\
524 Reset all flags to False.\n\
525 \n");
526
527 PyDoc_STRVAR(doc_ctx_clear_traps,
528 "clear_traps($self, /)\n--\n\n\
529 Set all traps to False.\n\
530 \n");
531
532 PyDoc_STRVAR(doc_ctx_copy,
533 "copy($self, /)\n--\n\n\
534 Return a duplicate of the context with all flags cleared.\n\
535 \n");
536
537 PyDoc_STRVAR(doc_ctx_copy_decimal,
538 "copy_decimal($self, x, /)\n--\n\n\
539 Return a copy of Decimal x.\n\
540 \n");
541
542 PyDoc_STRVAR(doc_ctx_create_decimal,
543 "create_decimal($self, num=\"0\", /)\n--\n\n\
544 Create a new Decimal instance from num, using self as the context. Unlike the\n\
545 Decimal constructor, this function observes the context limits.\n\
546 \n");
547
548 PyDoc_STRVAR(doc_ctx_create_decimal_from_float,
549 "create_decimal_from_float($self, f, /)\n--\n\n\
550 Create a new Decimal instance from float f. Unlike the Decimal.from_float()\n\
551 class method, this function observes the context limits.\n\
552 \n");
553
554 PyDoc_STRVAR(doc_ctx_Etiny,
555 "Etiny($self, /)\n--\n\n\
556 Return a value equal to Emin - prec + 1, which is the minimum exponent value\n\
557 for subnormal results. When underflow occurs, the exponent is set to Etiny.\n\
558 \n");
559
560 PyDoc_STRVAR(doc_ctx_Etop,
561 "Etop($self, /)\n--\n\n\
562 Return a value equal to Emax - prec + 1. This is the maximum exponent\n\
563 if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop()\n\
564 must not be negative.\n\
565 \n");
566
567 PyDoc_STRVAR(doc_ctx_abs,
568 "abs($self, x, /)\n--\n\n\
569 Return the absolute value of x.\n\
570 \n");
571
572 PyDoc_STRVAR(doc_ctx_add,
573 "add($self, x, y, /)\n--\n\n\
574 Return the sum of x and y.\n\
575 \n");
576
577 PyDoc_STRVAR(doc_ctx_canonical,
578 "canonical($self, x, /)\n--\n\n\
579 Return a new instance of x.\n\
580 \n");
581
582 PyDoc_STRVAR(doc_ctx_compare,
583 "compare($self, x, y, /)\n--\n\n\
584 Compare x and y numerically.\n\
585 \n");
586
587 PyDoc_STRVAR(doc_ctx_compare_signal,
588 "compare_signal($self, x, y, /)\n--\n\n\
589 Compare x and y numerically. All NaNs signal.\n\
590 \n");
591
592 PyDoc_STRVAR(doc_ctx_compare_total,
593 "compare_total($self, x, y, /)\n--\n\n\
594 Compare x and y using their abstract representation.\n\
595 \n");
596
597 PyDoc_STRVAR(doc_ctx_compare_total_mag,
598 "compare_total_mag($self, x, y, /)\n--\n\n\
599 Compare x and y using their abstract representation, ignoring sign.\n\
600 \n");
601
602 PyDoc_STRVAR(doc_ctx_copy_abs,
603 "copy_abs($self, x, /)\n--\n\n\
604 Return a copy of x with the sign set to 0.\n\
605 \n");
606
607 PyDoc_STRVAR(doc_ctx_copy_negate,
608 "copy_negate($self, x, /)\n--\n\n\
609 Return a copy of x with the sign inverted.\n\
610 \n");
611
612 PyDoc_STRVAR(doc_ctx_copy_sign,
613 "copy_sign($self, x, y, /)\n--\n\n\
614 Copy the sign from y to x.\n\
615 \n");
616
617 PyDoc_STRVAR(doc_ctx_divide,
618 "divide($self, x, y, /)\n--\n\n\
619 Return x divided by y.\n\
620 \n");
621
622 PyDoc_STRVAR(doc_ctx_divide_int,
623 "divide_int($self, x, y, /)\n--\n\n\
624 Return x divided by y, truncated to an integer.\n\
625 \n");
626
627 PyDoc_STRVAR(doc_ctx_divmod,
628 "divmod($self, x, y, /)\n--\n\n\
629 Return quotient and remainder of the division x / y.\n\
630 \n");
631
632 PyDoc_STRVAR(doc_ctx_exp,
633 "exp($self, x, /)\n--\n\n\
634 Return e ** x.\n\
635 \n");
636
637 PyDoc_STRVAR(doc_ctx_fma,
638 "fma($self, x, y, z, /)\n--\n\n\
639 Return x multiplied by y, plus z.\n\
640 \n");
641
642 PyDoc_STRVAR(doc_ctx_is_canonical,
643 "is_canonical($self, x, /)\n--\n\n\
644 Return True if x is canonical, False otherwise.\n\
645 \n");
646
647 PyDoc_STRVAR(doc_ctx_is_finite,
648 "is_finite($self, x, /)\n--\n\n\
649 Return True if x is finite, False otherwise.\n\
650 \n");
651
652 PyDoc_STRVAR(doc_ctx_is_infinite,
653 "is_infinite($self, x, /)\n--\n\n\
654 Return True if x is infinite, False otherwise.\n\
655 \n");
656
657 PyDoc_STRVAR(doc_ctx_is_nan,
658 "is_nan($self, x, /)\n--\n\n\
659 Return True if x is a qNaN or sNaN, False otherwise.\n\
660 \n");
661
662 PyDoc_STRVAR(doc_ctx_is_normal,
663 "is_normal($self, x, /)\n--\n\n\
664 Return True if x is a normal number, False otherwise.\n\
665 \n");
666
667 PyDoc_STRVAR(doc_ctx_is_qnan,
668 "is_qnan($self, x, /)\n--\n\n\
669 Return True if x is a quiet NaN, False otherwise.\n\
670 \n");
671
672 PyDoc_STRVAR(doc_ctx_is_signed,
673 "is_signed($self, x, /)\n--\n\n\
674 Return True if x is negative, False otherwise.\n\
675 \n");
676
677 PyDoc_STRVAR(doc_ctx_is_snan,
678 "is_snan($self, x, /)\n--\n\n\
679 Return True if x is a signaling NaN, False otherwise.\n\
680 \n");
681
682 PyDoc_STRVAR(doc_ctx_is_subnormal,
683 "is_subnormal($self, x, /)\n--\n\n\
684 Return True if x is subnormal, False otherwise.\n\
685 \n");
686
687 PyDoc_STRVAR(doc_ctx_is_zero,
688 "is_zero($self, x, /)\n--\n\n\
689 Return True if x is a zero, False otherwise.\n\
690 \n");
691
692 PyDoc_STRVAR(doc_ctx_ln,
693 "ln($self, x, /)\n--\n\n\
694 Return the natural (base e) logarithm of x.\n\
695 \n");
696
697 PyDoc_STRVAR(doc_ctx_log10,
698 "log10($self, x, /)\n--\n\n\
699 Return the base 10 logarithm of x.\n\
700 \n");
701
702 PyDoc_STRVAR(doc_ctx_logb,
703 "logb($self, x, /)\n--\n\n\
704 Return the exponent of the magnitude of the operand's MSD.\n\
705 \n");
706
707 PyDoc_STRVAR(doc_ctx_logical_and,
708 "logical_and($self, x, y, /)\n--\n\n\
709 Applies the logical operation 'and' between each operand's digits.\n\n\
710 The operands must be both logical numbers.\n\n\
711 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))\n\
712 Decimal('0')\n\
713 >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))\n\
714 Decimal('0')\n\
715 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))\n\
716 Decimal('0')\n\
717 >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))\n\
718 Decimal('1')\n\
719 >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))\n\
720 Decimal('1000')\n\
721 >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))\n\
722 Decimal('10')\n\
723 >>> ExtendedContext.logical_and(110, 1101)\n\
724 Decimal('100')\n\
725 >>> ExtendedContext.logical_and(Decimal(110), 1101)\n\
726 Decimal('100')\n\
727 >>> ExtendedContext.logical_and(110, Decimal(1101))\n\
728 Decimal('100')\n\
729 \n");
730
731 PyDoc_STRVAR(doc_ctx_logical_invert,
732 "logical_invert($self, x, /)\n--\n\n\
733 Invert all the digits in the operand.\n\n\
734 The operand must be a logical number.\n\n\
735 >>> ExtendedContext.logical_invert(Decimal('0'))\n\
736 Decimal('111111111')\n\
737 >>> ExtendedContext.logical_invert(Decimal('1'))\n\
738 Decimal('111111110')\n\
739 >>> ExtendedContext.logical_invert(Decimal('111111111'))\n\
740 Decimal('0')\n\
741 >>> ExtendedContext.logical_invert(Decimal('101010101'))\n\
742 Decimal('10101010')\n\
743 >>> ExtendedContext.logical_invert(1101)\n\
744 Decimal('111110010')\n\
745 \n");
746
747 PyDoc_STRVAR(doc_ctx_logical_or,
748 "logical_or($self, x, y, /)\n--\n\n\
749 Applies the logical operation 'or' between each operand's digits.\n\n\
750 The operands must be both logical numbers.\n\n\
751 >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))\n\
752 Decimal('0')\n\
753 >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))\n\
754 Decimal('1')\n\
755 >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))\n\
756 Decimal('1')\n\
757 >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))\n\
758 Decimal('1')\n\
759 >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))\n\
760 Decimal('1110')\n\
761 >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))\n\
762 Decimal('1110')\n\
763 >>> ExtendedContext.logical_or(110, 1101)\n\
764 Decimal('1111')\n\
765 >>> ExtendedContext.logical_or(Decimal(110), 1101)\n\
766 Decimal('1111')\n\
767 >>> ExtendedContext.logical_or(110, Decimal(1101))\n\
768 Decimal('1111')\n\
769 \n");
770
771 PyDoc_STRVAR(doc_ctx_logical_xor,
772 "logical_xor($self, x, y, /)\n--\n\n\
773 Applies the logical operation 'xor' between each operand's digits.\n\n\
774 The operands must be both logical numbers.\n\n\
775 >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))\n\
776 Decimal('0')\n\
777 >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))\n\
778 Decimal('1')\n\
779 >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))\n\
780 Decimal('1')\n\
781 >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))\n\
782 Decimal('0')\n\
783 >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))\n\
784 Decimal('110')\n\
785 >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))\n\
786 Decimal('1101')\n\
787 >>> ExtendedContext.logical_xor(110, 1101)\n\
788 Decimal('1011')\n\
789 >>> ExtendedContext.logical_xor(Decimal(110), 1101)\n\
790 Decimal('1011')\n\
791 >>> ExtendedContext.logical_xor(110, Decimal(1101))\n\
792 Decimal('1011')\n\
793 \n");
794
795 PyDoc_STRVAR(doc_ctx_max,
796 "max($self, x, y, /)\n--\n\n\
797 Compare the values numerically and return the maximum.\n\
798 \n");
799
800 PyDoc_STRVAR(doc_ctx_max_mag,
801 "max_mag($self, x, y, /)\n--\n\n\
802 Compare the values numerically with their sign ignored.\n\
803 \n");
804
805 PyDoc_STRVAR(doc_ctx_min,
806 "min($self, x, y, /)\n--\n\n\
807 Compare the values numerically and return the minimum.\n\
808 \n");
809
810 PyDoc_STRVAR(doc_ctx_min_mag,
811 "min_mag($self, x, y, /)\n--\n\n\
812 Compare the values numerically with their sign ignored.\n\
813 \n");
814
815 PyDoc_STRVAR(doc_ctx_minus,
816 "minus($self, x, /)\n--\n\n\
817 Minus corresponds to the unary prefix minus operator in Python, but applies\n\
818 the context to the result.\n\
819 \n");
820
821 PyDoc_STRVAR(doc_ctx_multiply,
822 "multiply($self, x, y, /)\n--\n\n\
823 Return the product of x and y.\n\
824 \n");
825
826 PyDoc_STRVAR(doc_ctx_next_minus,
827 "next_minus($self, x, /)\n--\n\n\
828 Return the largest representable number smaller than x.\n\
829 \n");
830
831 PyDoc_STRVAR(doc_ctx_next_plus,
832 "next_plus($self, x, /)\n--\n\n\
833 Return the smallest representable number larger than x.\n\
834 \n");
835
836 PyDoc_STRVAR(doc_ctx_next_toward,
837 "next_toward($self, x, y, /)\n--\n\n\
838 Return the number closest to x, in the direction towards y.\n\
839 \n");
840
841 PyDoc_STRVAR(doc_ctx_normalize,
842 "normalize($self, x, /)\n--\n\n\
843 Reduce x to its simplest form. Alias for reduce(x).\n\
844 \n");
845
846 PyDoc_STRVAR(doc_ctx_number_class,
847 "number_class($self, x, /)\n--\n\n\
848 Return an indication of the class of x.\n\
849 \n");
850
851 PyDoc_STRVAR(doc_ctx_plus,
852 "plus($self, x, /)\n--\n\n\
853 Plus corresponds to the unary prefix plus operator in Python, but applies\n\
854 the context to the result.\n\
855 \n");
856
857 PyDoc_STRVAR(doc_ctx_power,
858 "power($self, /, a, b, modulo=None)\n--\n\n\
859 Compute a**b. If 'a' is negative, then 'b' must be integral. The result\n\
860 will be inexact unless 'a' is integral and the result is finite and can\n\
861 be expressed exactly in 'precision' digits. In the Python version the\n\
862 result is always correctly rounded, in the C version the result is almost\n\
863 always correctly rounded.\n\
864 \n\
865 If modulo is given, compute (a**b) % modulo. The following restrictions\n\
866 hold:\n\
867 \n\
868 * all three arguments must be integral\n\
869 * 'b' must be nonnegative\n\
870 * at least one of 'a' or 'b' must be nonzero\n\
871 * modulo must be nonzero and less than 10**prec in absolute value\n\
872 \n\
873 \n");
874
875 PyDoc_STRVAR(doc_ctx_quantize,
876 "quantize($self, x, y, /)\n--\n\n\
877 Return a value equal to x (rounded), having the exponent of y.\n\
878 \n");
879
880 PyDoc_STRVAR(doc_ctx_radix,
881 "radix($self, /)\n--\n\n\
882 Return 10.\n\
883 \n");
884
885 PyDoc_STRVAR(doc_ctx_remainder,
886 "remainder($self, x, y, /)\n--\n\n\
887 Return the remainder from integer division. The sign of the result,\n\
888 if non-zero, is the same as that of the original dividend.\n\
889 \n");
890
891 PyDoc_STRVAR(doc_ctx_remainder_near,
892 "remainder_near($self, x, y, /)\n--\n\n\
893 Return x - y * n, where n is the integer nearest the exact value of x / y\n\
894 (if the result is 0 then its sign will be the sign of x).\n\
895 \n");
896
897 PyDoc_STRVAR(doc_ctx_rotate,
898 "rotate($self, x, y, /)\n--\n\n\
899 Return a copy of x, rotated by y places.\n\
900 \n");
901
902 PyDoc_STRVAR(doc_ctx_same_quantum,
903 "same_quantum($self, x, y, /)\n--\n\n\
904 Return True if the two operands have the same exponent.\n\
905 \n");
906
907 PyDoc_STRVAR(doc_ctx_scaleb,
908 "scaleb($self, x, y, /)\n--\n\n\
909 Return the first operand after adding the second value to its exp.\n\
910 \n");
911
912 PyDoc_STRVAR(doc_ctx_shift,
913 "shift($self, x, y, /)\n--\n\n\
914 Return a copy of x, shifted by y places.\n\
915 \n");
916
917 PyDoc_STRVAR(doc_ctx_sqrt,
918 "sqrt($self, x, /)\n--\n\n\
919 Square root of a non-negative number to context precision.\n\
920 \n");
921
922 PyDoc_STRVAR(doc_ctx_subtract,
923 "subtract($self, x, y, /)\n--\n\n\
924 Return the difference between x and y.\n\
925 \n");
926
927 PyDoc_STRVAR(doc_ctx_to_eng_string,
928 "to_eng_string($self, x, /)\n--\n\n\
929 Convert a number to a string, using engineering notation.\n\
930 \n");
931
932 PyDoc_STRVAR(doc_ctx_to_integral,
933 "to_integral($self, x, /)\n--\n\n\
934 Identical to to_integral_value(x).\n\
935 \n");
936
937 PyDoc_STRVAR(doc_ctx_to_integral_exact,
938 "to_integral_exact($self, x, /)\n--\n\n\
939 Round to an integer. Signal if the result is rounded or inexact.\n\
940 \n");
941
942 PyDoc_STRVAR(doc_ctx_to_integral_value,
943 "to_integral_value($self, x, /)\n--\n\n\
944 Round to an integer.\n\
945 \n");
946
947 PyDoc_STRVAR(doc_ctx_to_sci_string,
948 "to_sci_string($self, x, /)\n--\n\n\
949 Convert a number to a string using scientific notation.\n\
950 \n");
951
952
953 #endif /* DOCSTRINGS_H */
954
955
956