blob: 71029a994bbeca3d46aa79a4b4d1220b3d6ca8cd [file] [log] [blame]
Stefan Krah1919b7e2012-03-21 18:25:23 +01001/*
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
19PyDoc_STRVAR(doc__decimal,
20"C decimal arithmetic module");
21
Stefan Krah5de1f822014-05-01 15:53:42 +020022PyDoc_STRVAR(doc_getcontext,
23"getcontext($module, /)\n--\n\n\
24Get the current default context.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010025\n");
26
Stefan Krah5de1f822014-05-01 15:53:42 +020027PyDoc_STRVAR(doc_setcontext,
28"setcontext($module, context, /)\n--\n\n\
29Set a new default context.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010030\n");
31
Stefan Krah5de1f822014-05-01 15:53:42 +020032PyDoc_STRVAR(doc_localcontext,
33"localcontext($module, /, ctx=None)\n--\n\n\
34Return a context manager that will set the default context to a copy of ctx\n\
35on entry to the with-statement and restore the previous default context when\n\
36exiting the with-statement. If no context is specified, a copy of the current\n\
37default context is used.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010038\n");
39
40#ifdef EXTRA_FUNCTIONALITY
Stefan Krah5de1f822014-05-01 15:53:42 +020041PyDoc_STRVAR(doc_ieee_context,
42"IEEEContext($module, bits, /)\n--\n\n\
43Return a context object initialized to the proper values for one of the\n\
44IEEE interchange formats. The argument must be a multiple of 32 and less\n\
45than IEEE_CONTEXT_MAX_BITS. For the most common values, the constants\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010046DECIMAL32, DECIMAL64 and DECIMAL128 are provided.\n\
47\n");
48#endif
49
50
51/******************************************************************************/
52/* Decimal Object and Methods */
53/******************************************************************************/
54
Stefan Krah5de1f822014-05-01 15:53:42 +020055PyDoc_STRVAR(doc_decimal,
56"Decimal(value=\"0\", context=None)\n--\n\n\
57Construct a new Decimal object. 'value' can be an integer, string, tuple,\n\
58or another Decimal object. If no value is given, return Decimal('0'). The\n\
59context does not affect the conversion and is only passed to determine if\n\
60the InvalidOperation trap is active.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010061\n");
62
Stefan Krah5de1f822014-05-01 15:53:42 +020063PyDoc_STRVAR(doc_adjusted,
64"adjusted($self, /)\n--\n\n\
65Return the adjusted exponent of the number. Defined as exp + digits - 1.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010066\n");
67
Stefan Krah5de1f822014-05-01 15:53:42 +020068PyDoc_STRVAR(doc_as_tuple,
69"as_tuple($self, /)\n--\n\n\
70Return a tuple representation of the number.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010071\n");
72
Stefan Krah5de1f822014-05-01 15:53:42 +020073PyDoc_STRVAR(doc_canonical,
74"canonical($self, /)\n--\n\n\
75Return the canonical encoding of the argument. Currently, the encoding\n\
76of a Decimal instance is always canonical, so this operation returns its\n\
77argument unchanged.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010078\n");
79
Stefan Krah5de1f822014-05-01 15:53:42 +020080PyDoc_STRVAR(doc_compare,
81"compare($self, /, other, context=None)\n--\n\n\
82Compare self to other. Return a decimal value:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010083\n\
84 a or b is a NaN ==> Decimal('NaN')\n\
85 a < b ==> Decimal('-1')\n\
86 a == b ==> Decimal('0')\n\
87 a > b ==> Decimal('1')\n\
88\n");
89
Stefan Krah5de1f822014-05-01 15:53:42 +020090PyDoc_STRVAR(doc_compare_signal,
91"compare_signal($self, /, other, context=None)\n--\n\n\
92Identical to compare, except that all NaNs signal.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010093\n");
94
Stefan Krah5de1f822014-05-01 15:53:42 +020095PyDoc_STRVAR(doc_compare_total,
96"compare_total($self, /, other, context=None)\n--\n\n\
97Compare two operands using their abstract representation rather than\n\
98their numerical value. Similar to the compare() method, but the result\n\
99gives a total ordering on Decimal instances. Two Decimal instances with\n\
100the same numeric value but different representations compare unequal\n\
101in this ordering:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100102\n\
103 >>> Decimal('12.0').compare_total(Decimal('12'))\n\
104 Decimal('-1')\n\
105\n\
106Quiet and signaling NaNs are also included in the total ordering. The result\n\
107of this function is Decimal('0') if both operands have the same representation,\n\
108Decimal('-1') if the first operand is lower in the total order than the second,\n\
109and Decimal('1') if the first operand is higher in the total order than the\n\
110second operand. See the specification for details of the total order.\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100111\n\
112This operation is unaffected by context and is quiet: no flags are changed\n\
113and no rounding is performed. As an exception, the C version may raise\n\
114InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100115\n");
116
Stefan Krah5de1f822014-05-01 15:53:42 +0200117PyDoc_STRVAR(doc_compare_total_mag,
118"compare_total_mag($self, /, other, context=None)\n--\n\n\
119Compare two operands using their abstract representation rather than their\n\
120value as in compare_total(), but ignoring the sign of each operand.\n\
121\n\
122x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()).\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100123\n\
124This operation is unaffected by context and is quiet: no flags are changed\n\
125and no rounding is performed. As an exception, the C version may raise\n\
126InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100127\n");
128
Stefan Krah5de1f822014-05-01 15:53:42 +0200129PyDoc_STRVAR(doc_conjugate,
130"conjugate($self, /)\n--\n\n\
131Return self.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100132\n");
133
Stefan Krah5de1f822014-05-01 15:53:42 +0200134PyDoc_STRVAR(doc_copy_abs,
135"copy_abs($self, /)\n--\n\n\
136Return the absolute value of the argument. This operation is unaffected by\n\
137context and is quiet: no flags are changed and no rounding is performed.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100138\n");
139
Stefan Krah5de1f822014-05-01 15:53:42 +0200140PyDoc_STRVAR(doc_copy_negate,
141"copy_negate($self, /)\n--\n\n\
142Return the negation of the argument. This operation is unaffected by context\n\
143and is quiet: no flags are changed and no rounding is performed.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100144\n");
145
Stefan Krah5de1f822014-05-01 15:53:42 +0200146PyDoc_STRVAR(doc_copy_sign,
147"copy_sign($self, /, other, context=None)\n--\n\n\
148Return a copy of the first operand with the sign set to be the same as the\n\
149sign of the second operand. For example:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100150\n\
151 >>> Decimal('2.3').copy_sign(Decimal('-1.5'))\n\
152 Decimal('-2.3')\n\
153\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100154This operation is unaffected by context and is quiet: no flags are changed\n\
155and no rounding is performed. As an exception, the C version may raise\n\
156InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100157\n");
158
Stefan Krah5de1f822014-05-01 15:53:42 +0200159PyDoc_STRVAR(doc_exp,
160"exp($self, /, context=None)\n--\n\n\
161Return the value of the (natural) exponential function e**x at the given\n\
162number. The function always uses the ROUND_HALF_EVEN mode and the result\n\
163is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100164\n");
165
Stefan Krah5de1f822014-05-01 15:53:42 +0200166PyDoc_STRVAR(doc_from_float,
Stefan Krah6b7786b2014-05-02 14:34:11 +0200167"from_float($type, f, /)\n--\n\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200168Class method that converts a float to a decimal number, exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100169Since 0.1 is not exactly representable in binary floating point,\n\
170Decimal.from_float(0.1) is not the same as Decimal('0.1').\n\
171\n\
172 >>> Decimal.from_float(0.1)\n\
173 Decimal('0.1000000000000000055511151231257827021181583404541015625')\n\
174 >>> Decimal.from_float(float('nan'))\n\
175 Decimal('NaN')\n\
176 >>> Decimal.from_float(float('inf'))\n\
177 Decimal('Infinity')\n\
178 >>> Decimal.from_float(float('-inf'))\n\
179 Decimal('-Infinity')\n\
180\n\
181\n");
182
Stefan Krah5de1f822014-05-01 15:53:42 +0200183PyDoc_STRVAR(doc_fma,
184"fma($self, /, other, third, context=None)\n--\n\n\
185Fused multiply-add. Return self*other+third with no rounding of the\n\
186intermediate product self*other.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100187\n\
188 >>> Decimal(2).fma(3, 5)\n\
189 Decimal('11')\n\
190\n\
191\n");
192
Stefan Krah5de1f822014-05-01 15:53:42 +0200193PyDoc_STRVAR(doc_is_canonical,
194"is_canonical($self, /)\n--\n\n\
195Return True if the argument is canonical and False otherwise. Currently,\n\
196a Decimal instance is always canonical, so this operation always returns\n\
197True.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100198\n");
199
Stefan Krah5de1f822014-05-01 15:53:42 +0200200PyDoc_STRVAR(doc_is_finite,
201"is_finite($self, /)\n--\n\n\
202Return True if the argument is a finite number, and False if the argument\n\
203is infinite or a NaN.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100204\n");
205
Stefan Krah5de1f822014-05-01 15:53:42 +0200206PyDoc_STRVAR(doc_is_infinite,
207"is_infinite($self, /)\n--\n\n\
208Return True if the argument is either positive or negative infinity and\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100209False otherwise.\n\
210\n");
211
Stefan Krah5de1f822014-05-01 15:53:42 +0200212PyDoc_STRVAR(doc_is_nan,
213"is_nan($self, /)\n--\n\n\
214Return True if the argument is a (quiet or signaling) NaN and False\n\
215otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100216\n");
217
Stefan Krah5de1f822014-05-01 15:53:42 +0200218PyDoc_STRVAR(doc_is_normal,
219"is_normal($self, /, context=None)\n--\n\n\
220Return True if the argument is a normal finite non-zero number with an\n\
221adjusted exponent greater than or equal to Emin. Return False if the\n\
222argument is zero, subnormal, infinite or a NaN.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100223\n");
224
Stefan Krah5de1f822014-05-01 15:53:42 +0200225PyDoc_STRVAR(doc_is_qnan,
226"is_qnan($self, /)\n--\n\n\
227Return True if the argument is a quiet NaN, and False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100228\n");
229
Stefan Krah5de1f822014-05-01 15:53:42 +0200230PyDoc_STRVAR(doc_is_signed,
231"is_signed($self, /)\n--\n\n\
232Return True if the argument has a negative sign and False otherwise.\n\
233Note that both zeros and NaNs can carry signs.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100234\n");
235
Stefan Krah5de1f822014-05-01 15:53:42 +0200236PyDoc_STRVAR(doc_is_snan,
237"is_snan($self, /)\n--\n\n\
238Return True if the argument is a signaling NaN and False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100239\n");
240
Stefan Krah5de1f822014-05-01 15:53:42 +0200241PyDoc_STRVAR(doc_is_subnormal,
242"is_subnormal($self, /, context=None)\n--\n\n\
243Return True if the argument is subnormal, and False otherwise. A number is\n\
244subnormal if it is non-zero, finite, and has an adjusted exponent less\n\
245than Emin.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100246\n");
247
Stefan Krah5de1f822014-05-01 15:53:42 +0200248PyDoc_STRVAR(doc_is_zero,
249"is_zero($self, /)\n--\n\n\
250Return True if the argument is a (positive or negative) zero and False\n\
251otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100252\n");
253
Stefan Krah5de1f822014-05-01 15:53:42 +0200254PyDoc_STRVAR(doc_ln,
255"ln($self, /, context=None)\n--\n\n\
256Return the natural (base e) logarithm of the operand. The function always\n\
257uses the ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100258\n");
259
Stefan Krah5de1f822014-05-01 15:53:42 +0200260PyDoc_STRVAR(doc_log10,
261"log10($self, /, context=None)\n--\n\n\
262Return the base ten logarithm of the operand. The function always uses the\n\
263ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100264\n");
265
Stefan Krah5de1f822014-05-01 15:53:42 +0200266PyDoc_STRVAR(doc_logb,
267"logb($self, /, context=None)\n--\n\n\
268For a non-zero number, return the adjusted exponent of the operand as a\n\
269Decimal instance. If the operand is a zero, then Decimal('-Infinity') is\n\
270returned and the DivisionByZero condition is raised. If the operand is\n\
271an infinity then Decimal('Infinity') is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100272\n");
273
Stefan Krah5de1f822014-05-01 15:53:42 +0200274PyDoc_STRVAR(doc_logical_and,
275"logical_and($self, /, other, context=None)\n--\n\n\
276Return the digit-wise 'and' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100277\n");
278
Stefan Krah5de1f822014-05-01 15:53:42 +0200279PyDoc_STRVAR(doc_logical_invert,
280"logical_invert($self, /, context=None)\n--\n\n\
281Return the digit-wise inversion of the (logical) operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100282\n");
283
Stefan Krah5de1f822014-05-01 15:53:42 +0200284PyDoc_STRVAR(doc_logical_or,
285"logical_or($self, /, other, context=None)\n--\n\n\
286Return the digit-wise 'or' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100287\n");
288
Stefan Krah5de1f822014-05-01 15:53:42 +0200289PyDoc_STRVAR(doc_logical_xor,
290"logical_xor($self, /, other, context=None)\n--\n\n\
291Return the digit-wise 'exclusive or' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100292\n");
293
Stefan Krah5de1f822014-05-01 15:53:42 +0200294PyDoc_STRVAR(doc_max,
295"max($self, /, other, context=None)\n--\n\n\
296Maximum of self and other. If one operand is a quiet NaN and the other is\n\
297numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100298\n");
299
Stefan Krah5de1f822014-05-01 15:53:42 +0200300PyDoc_STRVAR(doc_max_mag,
301"max_mag($self, /, other, context=None)\n--\n\n\
302Similar to the max() method, but the comparison is done using the absolute\n\
303values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100304\n");
305
Stefan Krah5de1f822014-05-01 15:53:42 +0200306PyDoc_STRVAR(doc_min,
307"min($self, /, other, context=None)\n--\n\n\
308Minimum of self and other. If one operand is a quiet NaN and the other is\n\
309numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100310\n");
311
Stefan Krah5de1f822014-05-01 15:53:42 +0200312PyDoc_STRVAR(doc_min_mag,
313"min_mag($self, /, other, context=None)\n--\n\n\
314Similar to the min() method, but the comparison is done using the absolute\n\
315values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100316\n");
317
Stefan Krah5de1f822014-05-01 15:53:42 +0200318PyDoc_STRVAR(doc_next_minus,
319"next_minus($self, /, context=None)\n--\n\n\
320Return the largest number representable in the given context (or in the\n\
321current default context if no context is given) that is smaller than the\n\
322given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100323\n");
324
Stefan Krah5de1f822014-05-01 15:53:42 +0200325PyDoc_STRVAR(doc_next_plus,
326"next_plus($self, /, context=None)\n--\n\n\
327Return the smallest number representable in the given context (or in the\n\
328current default context if no context is given) that is larger than the\n\
329given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100330\n");
331
Stefan Krah5de1f822014-05-01 15:53:42 +0200332PyDoc_STRVAR(doc_next_toward,
333"next_toward($self, /, other, context=None)\n--\n\n\
334If the two operands are unequal, return the number closest to the first\n\
335operand in the direction of the second operand. If both operands are\n\
336numerically equal, return a copy of the first operand with the sign set\n\
337to be the same as the sign of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100338\n");
339
Stefan Krah5de1f822014-05-01 15:53:42 +0200340PyDoc_STRVAR(doc_normalize,
341"normalize($self, /, context=None)\n--\n\n\
342Normalize the number by stripping the rightmost trailing zeros and\n\
343converting any result equal to Decimal('0') to Decimal('0e0'). Used\n\
344for producing canonical values for members of an equivalence class.\n\
345For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize\n\
346to the equivalent value Decimal('32.1').\n\
347\n");
348
349PyDoc_STRVAR(doc_number_class,
350"number_class($self, /, context=None)\n--\n\n\
351Return a string describing the class of the operand. The returned value\n\
352is one of the following ten strings:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100353\n\
354 * '-Infinity', indicating that the operand is negative infinity.\n\
355 * '-Normal', indicating that the operand is a negative normal number.\n\
356 * '-Subnormal', indicating that the operand is negative and subnormal.\n\
357 * '-Zero', indicating that the operand is a negative zero.\n\
358 * '+Zero', indicating that the operand is a positive zero.\n\
359 * '+Subnormal', indicating that the operand is positive and subnormal.\n\
360 * '+Normal', indicating that the operand is a positive normal number.\n\
361 * '+Infinity', indicating that the operand is positive infinity.\n\
362 * 'NaN', indicating that the operand is a quiet NaN (Not a Number).\n\
363 * 'sNaN', indicating that the operand is a signaling NaN.\n\
364\n\
365\n");
366
Stefan Krah5de1f822014-05-01 15:53:42 +0200367PyDoc_STRVAR(doc_quantize,
368"quantize($self, /, exp, rounding=None, context=None)\n--\n\n\
369Return a value equal to the first operand after rounding and having the\n\
370exponent of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100371\n\
372 >>> Decimal('1.41421356').quantize(Decimal('1.000'))\n\
373 Decimal('1.414')\n\
374\n\
375Unlike other operations, if the length of the coefficient after the quantize\n\
376operation would be greater than precision, then an InvalidOperation is signaled.\n\
377This guarantees that, unless there is an error condition, the quantized exponent\n\
378is always equal to that of the right-hand operand.\n\
379\n\
380Also unlike other operations, quantize never signals Underflow, even if the\n\
381result is subnormal and inexact.\n\
382\n\
383If the exponent of the second operand is larger than that of the first, then\n\
384rounding may be necessary. In this case, the rounding mode is determined by the\n\
385rounding argument if given, else by the given context argument; if neither\n\
386argument is given, the rounding mode of the current thread's context is used.\n\
387\n");
388
Stefan Krah5de1f822014-05-01 15:53:42 +0200389PyDoc_STRVAR(doc_radix,
390"radix($self, /)\n--\n\n\
391Return Decimal(10), the radix (base) in which the Decimal class does\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100392all its arithmetic. Included for compatibility with the specification.\n\
393\n");
394
Stefan Krah5de1f822014-05-01 15:53:42 +0200395PyDoc_STRVAR(doc_remainder_near,
396"remainder_near($self, /, other, context=None)\n--\n\n\
397Return the remainder from dividing self by other. This differs from\n\
398self % other in that the sign of the remainder is chosen so as to minimize\n\
399its absolute value. More precisely, the return value is self - n * other\n\
400where n is the integer nearest to the exact value of self / other, and\n\
401if two integers are equally near then the even one is chosen.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100402\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100403If the result is zero then its sign will be the sign of self.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100404\n");
405
Stefan Krah5de1f822014-05-01 15:53:42 +0200406PyDoc_STRVAR(doc_rotate,
407"rotate($self, /, other, context=None)\n--\n\n\
408Return the result of rotating the digits of the first operand by an amount\n\
409specified by the second operand. The second operand must be an integer in\n\
410the range -precision through precision. The absolute value of the second\n\
411operand gives the number of places to rotate. If the second operand is\n\
412positive then rotation is to the left; otherwise rotation is to the right.\n\
413The coefficient of the first operand is padded on the left with zeros to\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100414length precision if necessary. The sign and exponent of the first operand are\n\
415unchanged.\n\
416\n");
417
Stefan Krah5de1f822014-05-01 15:53:42 +0200418PyDoc_STRVAR(doc_same_quantum,
419"same_quantum($self, /, other, context=None)\n--\n\n\
420Test whether self and other have the same exponent or whether both are NaN.\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100421\n\
422This operation is unaffected by context and is quiet: no flags are changed\n\
423and no rounding is performed. As an exception, the C version may raise\n\
424InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100425\n");
426
Stefan Krah5de1f822014-05-01 15:53:42 +0200427PyDoc_STRVAR(doc_scaleb,
428"scaleb($self, /, other, context=None)\n--\n\n\
429Return the first operand with the exponent adjusted the second. Equivalently,\n\
430return the first operand multiplied by 10**other. The second operand must be\n\
431an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100432\n");
433
Stefan Krah5de1f822014-05-01 15:53:42 +0200434PyDoc_STRVAR(doc_shift,
435"shift($self, /, other, context=None)\n--\n\n\
436Return the result of shifting the digits of the first operand by an amount\n\
437specified by the second operand. The second operand must be an integer in\n\
438the range -precision through precision. The absolute value of the second\n\
439operand gives the number of places to shift. If the second operand is\n\
440positive, then the shift is to the left; otherwise the shift is to the\n\
441right. Digits shifted into the coefficient are zeros. The sign and exponent\n\
442of the first operand are unchanged.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100443\n");
444
Stefan Krah5de1f822014-05-01 15:53:42 +0200445PyDoc_STRVAR(doc_sqrt,
446"sqrt($self, /, context=None)\n--\n\n\
447Return the square root of the argument to full precision. The result is\n\
448correctly rounded using the ROUND_HALF_EVEN rounding mode.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100449\n");
450
Stefan Krah5de1f822014-05-01 15:53:42 +0200451PyDoc_STRVAR(doc_to_eng_string,
452"to_eng_string($self, /, context=None)\n--\n\n\
453Convert to an engineering-type string. Engineering notation has an exponent\n\
454which is a multiple of 3, so there are up to 3 digits left of the decimal\n\
455place. For example, Decimal('123E+1') is converted to Decimal('1.23E+3').\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100456\n\
457The value of context.capitals determines whether the exponent sign is lower\n\
458or upper case. Otherwise, the context does not affect the operation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100459\n");
460
Stefan Krah5de1f822014-05-01 15:53:42 +0200461PyDoc_STRVAR(doc_to_integral,
462"to_integral($self, /, rounding=None, context=None)\n--\n\n\
463Identical to the to_integral_value() method. The to_integral() name has been\n\
464kept for compatibility with older versions.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100465\n");
466
Stefan Krah5de1f822014-05-01 15:53:42 +0200467PyDoc_STRVAR(doc_to_integral_exact,
468"to_integral_exact($self, /, rounding=None, context=None)\n--\n\n\
469Round to the nearest integer, signaling Inexact or Rounded as appropriate if\n\
470rounding occurs. The rounding mode is determined by the rounding parameter\n\
471if given, else by the given context. If neither parameter is given, then the\n\
472rounding mode of the current default context is used.\n\
473\n");
474
475PyDoc_STRVAR(doc_to_integral_value,
476"to_integral_value($self, /, rounding=None, context=None)\n--\n\n\
477Round to the nearest integer without signaling Inexact or Rounded. The\n\
478rounding mode is determined by the rounding parameter if given, else by\n\
479the given context. If neither parameter is given, then the rounding mode\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100480of the current default context is used.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100481\n");
482
Stefan Krah1919b7e2012-03-21 18:25:23 +0100483
484/******************************************************************************/
485/* Context Object and Methods */
486/******************************************************************************/
487
Stefan Krah5de1f822014-05-01 15:53:42 +0200488PyDoc_STRVAR(doc_context,
489"Context(prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None)\n--\n\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100490The context affects almost all operations and controls rounding,\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200491Over/Underflow, raising of exceptions and much more. A new context\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100492can be constructed as follows:\n\
493\n\
494 >>> c = Context(prec=28, Emin=-425000000, Emax=425000000,\n\
495 ... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,\n\
496 ... traps=[InvalidOperation, DivisionByZero, Overflow],\n\
497 ... flags=[])\n\
498 >>>\n\
499\n\
500\n");
501
502#ifdef EXTRA_FUNCTIONALITY
Stefan Krah5de1f822014-05-01 15:53:42 +0200503PyDoc_STRVAR(doc_ctx_apply,
504"apply($self, x, /)\n--\n\n\
505Apply self to Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100506\n");
507#endif
508
Stefan Krah5de1f822014-05-01 15:53:42 +0200509PyDoc_STRVAR(doc_ctx_clear_flags,
510"clear_flags($self, /)\n--\n\n\
511Reset all flags to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100512\n");
513
Stefan Krah5de1f822014-05-01 15:53:42 +0200514PyDoc_STRVAR(doc_ctx_clear_traps,
515"clear_traps($self, /)\n--\n\n\
516Set all traps to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100517\n");
518
Stefan Krah5de1f822014-05-01 15:53:42 +0200519PyDoc_STRVAR(doc_ctx_copy,
520"copy($self, /)\n--\n\n\
521Return a duplicate of the context with all flags cleared.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100522\n");
523
Stefan Krah5de1f822014-05-01 15:53:42 +0200524PyDoc_STRVAR(doc_ctx_copy_decimal,
525"copy_decimal($self, x, /)\n--\n\n\
526Return a copy of Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100527\n");
528
Stefan Krah5de1f822014-05-01 15:53:42 +0200529PyDoc_STRVAR(doc_ctx_create_decimal,
530"create_decimal($self, num=\"0\", /)\n--\n\n\
531Create a new Decimal instance from num, using self as the context. Unlike the\n\
532Decimal constructor, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100533\n");
534
Stefan Krah5de1f822014-05-01 15:53:42 +0200535PyDoc_STRVAR(doc_ctx_create_decimal_from_float,
536"create_decimal_from_float($self, f, /)\n--\n\n\
537Create a new Decimal instance from float f. Unlike the Decimal.from_float()\n\
538class method, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100539\n");
540
Stefan Krah5de1f822014-05-01 15:53:42 +0200541PyDoc_STRVAR(doc_ctx_Etiny,
542"Etiny($self, /)\n--\n\n\
543Return a value equal to Emin - prec + 1, which is the minimum exponent value\n\
544for subnormal results. When underflow occurs, the exponent is set to Etiny.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100545\n");
546
Stefan Krah5de1f822014-05-01 15:53:42 +0200547PyDoc_STRVAR(doc_ctx_Etop,
548"Etop($self, /)\n--\n\n\
549Return a value equal to Emax - prec + 1. This is the maximum exponent\n\
550if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop()\n\
551must not be negative.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100552\n");
553
Stefan Krah5de1f822014-05-01 15:53:42 +0200554PyDoc_STRVAR(doc_ctx_abs,
555"abs($self, x, /)\n--\n\n\
556Return the absolute value of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100557\n");
558
Stefan Krah5de1f822014-05-01 15:53:42 +0200559PyDoc_STRVAR(doc_ctx_add,
560"add($self, x, y, /)\n--\n\n\
561Return the sum of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100562\n");
563
Stefan Krah5de1f822014-05-01 15:53:42 +0200564PyDoc_STRVAR(doc_ctx_canonical,
565"canonical($self, x, /)\n--\n\n\
566Return a new instance of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100567\n");
568
Stefan Krah5de1f822014-05-01 15:53:42 +0200569PyDoc_STRVAR(doc_ctx_compare,
570"compare($self, x, y, /)\n--\n\n\
571Compare x and y numerically.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100572\n");
573
Stefan Krah5de1f822014-05-01 15:53:42 +0200574PyDoc_STRVAR(doc_ctx_compare_signal,
575"compare_signal($self, x, y, /)\n--\n\n\
576Compare x and y numerically. All NaNs signal.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100577\n");
578
Stefan Krah5de1f822014-05-01 15:53:42 +0200579PyDoc_STRVAR(doc_ctx_compare_total,
580"compare_total($self, x, y, /)\n--\n\n\
581Compare x and y using their abstract representation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100582\n");
583
Stefan Krah5de1f822014-05-01 15:53:42 +0200584PyDoc_STRVAR(doc_ctx_compare_total_mag,
585"compare_total_mag($self, x, y, /)\n--\n\n\
586Compare x and y using their abstract representation, ignoring sign.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100587\n");
588
Stefan Krah5de1f822014-05-01 15:53:42 +0200589PyDoc_STRVAR(doc_ctx_copy_abs,
590"copy_abs($self, x, /)\n--\n\n\
591Return a copy of x with the sign set to 0.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100592\n");
593
Stefan Krah5de1f822014-05-01 15:53:42 +0200594PyDoc_STRVAR(doc_ctx_copy_negate,
595"copy_negate($self, x, /)\n--\n\n\
596Return a copy of x with the sign inverted.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100597\n");
598
Stefan Krah5de1f822014-05-01 15:53:42 +0200599PyDoc_STRVAR(doc_ctx_copy_sign,
600"copy_sign($self, x, y, /)\n--\n\n\
601Copy the sign from y to x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100602\n");
603
Stefan Krah5de1f822014-05-01 15:53:42 +0200604PyDoc_STRVAR(doc_ctx_divide,
605"divide($self, x, y, /)\n--\n\n\
606Return x divided by y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100607\n");
608
Stefan Krah5de1f822014-05-01 15:53:42 +0200609PyDoc_STRVAR(doc_ctx_divide_int,
610"divide_int($self, x, y, /)\n--\n\n\
611Return x divided by y, truncated to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100612\n");
613
Stefan Krah5de1f822014-05-01 15:53:42 +0200614PyDoc_STRVAR(doc_ctx_divmod,
615"divmod($self, x, y, /)\n--\n\n\
616Return quotient and remainder of the division x / y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100617\n");
618
Stefan Krah5de1f822014-05-01 15:53:42 +0200619PyDoc_STRVAR(doc_ctx_exp,
620"exp($self, x, /)\n--\n\n\
621Return e ** x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100622\n");
623
Stefan Krah5de1f822014-05-01 15:53:42 +0200624PyDoc_STRVAR(doc_ctx_fma,
625"fma($self, x, y, z, /)\n--\n\n\
626Return x multiplied by y, plus z.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100627\n");
628
Stefan Krah5de1f822014-05-01 15:53:42 +0200629PyDoc_STRVAR(doc_ctx_is_canonical,
630"is_canonical($self, x, /)\n--\n\n\
631Return True if x is canonical, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100632\n");
633
Stefan Krah5de1f822014-05-01 15:53:42 +0200634PyDoc_STRVAR(doc_ctx_is_finite,
635"is_finite($self, x, /)\n--\n\n\
636Return True if x is finite, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100637\n");
638
Stefan Krah5de1f822014-05-01 15:53:42 +0200639PyDoc_STRVAR(doc_ctx_is_infinite,
640"is_infinite($self, x, /)\n--\n\n\
641Return True if x is infinite, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100642\n");
643
Stefan Krah5de1f822014-05-01 15:53:42 +0200644PyDoc_STRVAR(doc_ctx_is_nan,
645"is_nan($self, x, /)\n--\n\n\
646Return True if x is a qNaN or sNaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100647\n");
648
Stefan Krah5de1f822014-05-01 15:53:42 +0200649PyDoc_STRVAR(doc_ctx_is_normal,
650"is_normal($self, x, /)\n--\n\n\
651Return True if x is a normal number, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100652\n");
653
Stefan Krah5de1f822014-05-01 15:53:42 +0200654PyDoc_STRVAR(doc_ctx_is_qnan,
655"is_qnan($self, x, /)\n--\n\n\
656Return True if x is a quiet NaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100657\n");
658
Stefan Krah5de1f822014-05-01 15:53:42 +0200659PyDoc_STRVAR(doc_ctx_is_signed,
660"is_signed($self, x, /)\n--\n\n\
661Return True if x is negative, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100662\n");
663
Stefan Krah5de1f822014-05-01 15:53:42 +0200664PyDoc_STRVAR(doc_ctx_is_snan,
665"is_snan($self, x, /)\n--\n\n\
666Return True if x is a signaling NaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100667\n");
668
Stefan Krah5de1f822014-05-01 15:53:42 +0200669PyDoc_STRVAR(doc_ctx_is_subnormal,
670"is_subnormal($self, x, /)\n--\n\n\
671Return True if x is subnormal, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100672\n");
673
Stefan Krah5de1f822014-05-01 15:53:42 +0200674PyDoc_STRVAR(doc_ctx_is_zero,
675"is_zero($self, x, /)\n--\n\n\
676Return True if x is a zero, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100677\n");
678
Stefan Krah5de1f822014-05-01 15:53:42 +0200679PyDoc_STRVAR(doc_ctx_ln,
680"ln($self, x, /)\n--\n\n\
681Return the natural (base e) logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100682\n");
683
Stefan Krah5de1f822014-05-01 15:53:42 +0200684PyDoc_STRVAR(doc_ctx_log10,
685"log10($self, x, /)\n--\n\n\
686Return the base 10 logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100687\n");
688
Stefan Krah5de1f822014-05-01 15:53:42 +0200689PyDoc_STRVAR(doc_ctx_logb,
690"logb($self, x, /)\n--\n\n\
691Return the exponent of the magnitude of the operand's MSD.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100692\n");
693
Stefan Krah5de1f822014-05-01 15:53:42 +0200694PyDoc_STRVAR(doc_ctx_logical_and,
695"logical_and($self, x, y, /)\n--\n\n\
696Digit-wise and of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100697\n");
698
Stefan Krah5de1f822014-05-01 15:53:42 +0200699PyDoc_STRVAR(doc_ctx_logical_invert,
700"logical_invert($self, x, /)\n--\n\n\
701Invert all digits of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100702\n");
703
Stefan Krah5de1f822014-05-01 15:53:42 +0200704PyDoc_STRVAR(doc_ctx_logical_or,
705"logical_or($self, x, y, /)\n--\n\n\
706Digit-wise or of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100707\n");
708
Stefan Krah5de1f822014-05-01 15:53:42 +0200709PyDoc_STRVAR(doc_ctx_logical_xor,
710"logical_xor($self, x, y, /)\n--\n\n\
711Digit-wise xor of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100712\n");
713
Stefan Krah5de1f822014-05-01 15:53:42 +0200714PyDoc_STRVAR(doc_ctx_max,
715"max($self, x, y, /)\n--\n\n\
716Compare the values numerically and return the maximum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100717\n");
718
Stefan Krah5de1f822014-05-01 15:53:42 +0200719PyDoc_STRVAR(doc_ctx_max_mag,
720"max_mag($self, x, y, /)\n--\n\n\
721Compare the values numerically with their sign ignored.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100722\n");
723
Stefan Krah5de1f822014-05-01 15:53:42 +0200724PyDoc_STRVAR(doc_ctx_min,
725"min($self, x, y, /)\n--\n\n\
726Compare the values numerically and return the minimum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100727\n");
728
Stefan Krah5de1f822014-05-01 15:53:42 +0200729PyDoc_STRVAR(doc_ctx_min_mag,
730"min_mag($self, x, y, /)\n--\n\n\
731Compare the values numerically with their sign ignored.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100732\n");
733
Stefan Krah5de1f822014-05-01 15:53:42 +0200734PyDoc_STRVAR(doc_ctx_minus,
735"minus($self, x, /)\n--\n\n\
736Minus corresponds to the unary prefix minus operator in Python, but applies\n\
737the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100738\n");
739
Stefan Krah5de1f822014-05-01 15:53:42 +0200740PyDoc_STRVAR(doc_ctx_multiply,
741"multiply($self, x, y, /)\n--\n\n\
742Return the product of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100743\n");
744
Stefan Krah5de1f822014-05-01 15:53:42 +0200745PyDoc_STRVAR(doc_ctx_next_minus,
746"next_minus($self, x, /)\n--\n\n\
747Return the largest representable number smaller than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100748\n");
749
Stefan Krah5de1f822014-05-01 15:53:42 +0200750PyDoc_STRVAR(doc_ctx_next_plus,
751"next_plus($self, x, /)\n--\n\n\
752Return the smallest representable number larger than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100753\n");
754
Stefan Krah5de1f822014-05-01 15:53:42 +0200755PyDoc_STRVAR(doc_ctx_next_toward,
756"next_toward($self, x, y, /)\n--\n\n\
757Return the number closest to x, in the direction towards y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100758\n");
759
Stefan Krah5de1f822014-05-01 15:53:42 +0200760PyDoc_STRVAR(doc_ctx_normalize,
761"normalize($self, x, /)\n--\n\n\
762Reduce x to its simplest form. Alias for reduce(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100763\n");
764
Stefan Krah5de1f822014-05-01 15:53:42 +0200765PyDoc_STRVAR(doc_ctx_number_class,
766"number_class($self, x, /)\n--\n\n\
767Return an indication of the class of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100768\n");
769
Stefan Krah5de1f822014-05-01 15:53:42 +0200770PyDoc_STRVAR(doc_ctx_plus,
771"plus($self, x, /)\n--\n\n\
772Plus corresponds to the unary prefix plus operator in Python, but applies\n\
773the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100774\n");
775
Stefan Krah5de1f822014-05-01 15:53:42 +0200776PyDoc_STRVAR(doc_ctx_power,
777"power($self, /, a, b, modulo=None)\n--\n\n\
778Compute a**b. If 'a' is negative, then 'b' must be integral. The result\n\
779will be inexact unless 'a' is integral and the result is finite and can\n\
780be expressed exactly in 'precision' digits. In the Python version the\n\
781result is always correctly rounded, in the C version the result is almost\n\
782always correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100783\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200784If modulo is given, compute (a**b) % modulo. The following restrictions\n\
785hold:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100786\n\
787 * all three arguments must be integral\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200788 * 'b' must be nonnegative\n\
789 * at least one of 'a' or 'b' must be nonzero\n\
790 * modulo must be nonzero and less than 10**prec in absolute value\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100791\n\
792\n");
793
Stefan Krah5de1f822014-05-01 15:53:42 +0200794PyDoc_STRVAR(doc_ctx_quantize,
795"quantize($self, x, y, /)\n--\n\n\
796Return a value equal to x (rounded), having the exponent of y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100797\n");
798
Stefan Krah5de1f822014-05-01 15:53:42 +0200799PyDoc_STRVAR(doc_ctx_radix,
800"radix($self, /)\n--\n\n\
801Return 10.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100802\n");
803
Stefan Krah5de1f822014-05-01 15:53:42 +0200804PyDoc_STRVAR(doc_ctx_remainder,
805"remainder($self, x, y, /)\n--\n\n\
806Return the remainder from integer division. The sign of the result,\n\
807if non-zero, is the same as that of the original dividend.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100808\n");
809
Stefan Krah5de1f822014-05-01 15:53:42 +0200810PyDoc_STRVAR(doc_ctx_remainder_near,
811"remainder_near($self, x, y, /)\n--\n\n\
812Return x - y * n, where n is the integer nearest the exact value of x / y\n\
813(if the result is 0 then its sign will be the sign of x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100814\n");
815
Stefan Krah5de1f822014-05-01 15:53:42 +0200816PyDoc_STRVAR(doc_ctx_rotate,
817"rotate($self, x, y, /)\n--\n\n\
818Return a copy of x, rotated by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100819\n");
820
Stefan Krah5de1f822014-05-01 15:53:42 +0200821PyDoc_STRVAR(doc_ctx_same_quantum,
822"same_quantum($self, x, y, /)\n--\n\n\
823Return True if the two operands have the same exponent.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100824\n");
825
Stefan Krah5de1f822014-05-01 15:53:42 +0200826PyDoc_STRVAR(doc_ctx_scaleb,
827"scaleb($self, x, y, /)\n--\n\n\
828Return the first operand after adding the second value to its exp.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100829\n");
830
Stefan Krah5de1f822014-05-01 15:53:42 +0200831PyDoc_STRVAR(doc_ctx_shift,
832"shift($self, x, y, /)\n--\n\n\
833Return a copy of x, shifted by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100834\n");
835
Stefan Krah5de1f822014-05-01 15:53:42 +0200836PyDoc_STRVAR(doc_ctx_sqrt,
837"sqrt($self, x, /)\n--\n\n\
838Square root of a non-negative number to context precision.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100839\n");
840
Stefan Krah5de1f822014-05-01 15:53:42 +0200841PyDoc_STRVAR(doc_ctx_subtract,
842"subtract($self, x, y, /)\n--\n\n\
843Return the difference between x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100844\n");
845
Stefan Krah5de1f822014-05-01 15:53:42 +0200846PyDoc_STRVAR(doc_ctx_to_eng_string,
847"to_eng_string($self, x, /)\n--\n\n\
848Convert a number to a string, using engineering notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100849\n");
850
Stefan Krah5de1f822014-05-01 15:53:42 +0200851PyDoc_STRVAR(doc_ctx_to_integral,
852"to_integral($self, x, /)\n--\n\n\
853Identical to to_integral_value(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100854\n");
855
Stefan Krah5de1f822014-05-01 15:53:42 +0200856PyDoc_STRVAR(doc_ctx_to_integral_exact,
857"to_integral_exact($self, x, /)\n--\n\n\
858Round to an integer. Signal if the result is rounded or inexact.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100859\n");
860
Stefan Krah5de1f822014-05-01 15:53:42 +0200861PyDoc_STRVAR(doc_ctx_to_integral_value,
862"to_integral_value($self, x, /)\n--\n\n\
863Round to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100864\n");
865
Stefan Krah5de1f822014-05-01 15:53:42 +0200866PyDoc_STRVAR(doc_ctx_to_sci_string,
867"to_sci_string($self, x, /)\n--\n\n\
868Convert a number to a string using scientific notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100869\n");
870
871
872#endif /* DOCSTRINGS_H */
873
874
875