blob: f7fd6e795299845f44f43b8479f39a00d282fde2 [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 Krah53f2e0a2015-12-28 23:02:02 +010073PyDoc_STRVAR(doc_as_integer_ratio,
74"as_integer_ratio($self, /)\n--\n\n\
75Decimal.as_integer_ratio() -> (int, int)\n\
76\n\
77Return a pair of integers, whose ratio is exactly equal to the original\n\
78Decimal and with a positive denominator. The ratio is in lowest terms.\n\
79Raise OverflowError on infinities and a ValueError on NaNs.\n\
80\n");
81
Stefan Krah5de1f822014-05-01 15:53:42 +020082PyDoc_STRVAR(doc_canonical,
83"canonical($self, /)\n--\n\n\
84Return the canonical encoding of the argument. Currently, the encoding\n\
85of a Decimal instance is always canonical, so this operation returns its\n\
86argument unchanged.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010087\n");
88
Stefan Krah5de1f822014-05-01 15:53:42 +020089PyDoc_STRVAR(doc_compare,
90"compare($self, /, other, context=None)\n--\n\n\
91Compare self to other. Return a decimal value:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +010092\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
Stefan Krah5de1f822014-05-01 15:53:42 +020099PyDoc_STRVAR(doc_compare_signal,
100"compare_signal($self, /, other, context=None)\n--\n\n\
101Identical to compare, except that all NaNs signal.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100102\n");
103
Stefan Krah5de1f822014-05-01 15:53:42 +0200104PyDoc_STRVAR(doc_compare_total,
105"compare_total($self, /, other, context=None)\n--\n\n\
106Compare two operands using their abstract representation rather than\n\
107their numerical value. Similar to the compare() method, but the result\n\
108gives a total ordering on Decimal instances. Two Decimal instances with\n\
109the same numeric value but different representations compare unequal\n\
110in this ordering:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100111\n\
112 >>> Decimal('12.0').compare_total(Decimal('12'))\n\
113 Decimal('-1')\n\
114\n\
115Quiet and signaling NaNs are also included in the total ordering. The result\n\
116of this function is Decimal('0') if both operands have the same representation,\n\
117Decimal('-1') if the first operand is lower in the total order than the second,\n\
118and Decimal('1') if the first operand is higher in the total order than the\n\
119second operand. See the specification for details of the total order.\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100120\n\
121This operation is unaffected by context and is quiet: no flags are changed\n\
122and no rounding is performed. As an exception, the C version may raise\n\
123InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100124\n");
125
Stefan Krah5de1f822014-05-01 15:53:42 +0200126PyDoc_STRVAR(doc_compare_total_mag,
127"compare_total_mag($self, /, other, context=None)\n--\n\n\
128Compare two operands using their abstract representation rather than their\n\
129value as in compare_total(), but ignoring the sign of each operand.\n\
130\n\
131x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()).\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100132\n\
133This operation is unaffected by context and is quiet: no flags are changed\n\
134and no rounding is performed. As an exception, the C version may raise\n\
135InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100136\n");
137
Stefan Krah5de1f822014-05-01 15:53:42 +0200138PyDoc_STRVAR(doc_conjugate,
139"conjugate($self, /)\n--\n\n\
140Return self.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100141\n");
142
Stefan Krah5de1f822014-05-01 15:53:42 +0200143PyDoc_STRVAR(doc_copy_abs,
144"copy_abs($self, /)\n--\n\n\
145Return the absolute value of the argument. This operation is unaffected by\n\
146context and is quiet: no flags are changed and no rounding is performed.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100147\n");
148
Stefan Krah5de1f822014-05-01 15:53:42 +0200149PyDoc_STRVAR(doc_copy_negate,
150"copy_negate($self, /)\n--\n\n\
151Return the negation of the argument. This operation is unaffected by context\n\
152and is quiet: no flags are changed and no rounding is performed.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100153\n");
154
Stefan Krah5de1f822014-05-01 15:53:42 +0200155PyDoc_STRVAR(doc_copy_sign,
156"copy_sign($self, /, other, context=None)\n--\n\n\
157Return a copy of the first operand with the sign set to be the same as the\n\
158sign of the second operand. For example:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100159\n\
160 >>> Decimal('2.3').copy_sign(Decimal('-1.5'))\n\
161 Decimal('-2.3')\n\
162\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100163This operation is unaffected by context and is quiet: no flags are changed\n\
164and no rounding is performed. As an exception, the C version may raise\n\
165InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100166\n");
167
Stefan Krah5de1f822014-05-01 15:53:42 +0200168PyDoc_STRVAR(doc_exp,
169"exp($self, /, context=None)\n--\n\n\
170Return the value of the (natural) exponential function e**x at the given\n\
171number. The function always uses the ROUND_HALF_EVEN mode and the result\n\
172is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100173\n");
174
Stefan Krah5de1f822014-05-01 15:53:42 +0200175PyDoc_STRVAR(doc_from_float,
Stefan Krah6b7786b2014-05-02 14:34:11 +0200176"from_float($type, f, /)\n--\n\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200177Class method that converts a float to a decimal number, exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100178Since 0.1 is not exactly representable in binary floating point,\n\
179Decimal.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
Stefan Krah5de1f822014-05-01 15:53:42 +0200192PyDoc_STRVAR(doc_fma,
193"fma($self, /, other, third, context=None)\n--\n\n\
194Fused multiply-add. Return self*other+third with no rounding of the\n\
195intermediate product self*other.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100196\n\
197 >>> Decimal(2).fma(3, 5)\n\
198 Decimal('11')\n\
199\n\
200\n");
201
Stefan Krah5de1f822014-05-01 15:53:42 +0200202PyDoc_STRVAR(doc_is_canonical,
203"is_canonical($self, /)\n--\n\n\
204Return True if the argument is canonical and False otherwise. Currently,\n\
205a Decimal instance is always canonical, so this operation always returns\n\
206True.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100207\n");
208
Stefan Krah5de1f822014-05-01 15:53:42 +0200209PyDoc_STRVAR(doc_is_finite,
210"is_finite($self, /)\n--\n\n\
211Return True if the argument is a finite number, and False if the argument\n\
212is infinite or a NaN.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100213\n");
214
Stefan Krah5de1f822014-05-01 15:53:42 +0200215PyDoc_STRVAR(doc_is_infinite,
216"is_infinite($self, /)\n--\n\n\
217Return True if the argument is either positive or negative infinity and\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100218False otherwise.\n\
219\n");
220
Stefan Krah5de1f822014-05-01 15:53:42 +0200221PyDoc_STRVAR(doc_is_nan,
222"is_nan($self, /)\n--\n\n\
223Return True if the argument is a (quiet or signaling) NaN and False\n\
224otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100225\n");
226
Stefan Krah5de1f822014-05-01 15:53:42 +0200227PyDoc_STRVAR(doc_is_normal,
228"is_normal($self, /, context=None)\n--\n\n\
229Return True if the argument is a normal finite non-zero number with an\n\
230adjusted exponent greater than or equal to Emin. Return False if the\n\
231argument is zero, subnormal, infinite or a NaN.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100232\n");
233
Stefan Krah5de1f822014-05-01 15:53:42 +0200234PyDoc_STRVAR(doc_is_qnan,
235"is_qnan($self, /)\n--\n\n\
236Return True if the argument is a quiet NaN, and False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100237\n");
238
Stefan Krah5de1f822014-05-01 15:53:42 +0200239PyDoc_STRVAR(doc_is_signed,
240"is_signed($self, /)\n--\n\n\
241Return True if the argument has a negative sign and False otherwise.\n\
242Note that both zeros and NaNs can carry signs.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100243\n");
244
Stefan Krah5de1f822014-05-01 15:53:42 +0200245PyDoc_STRVAR(doc_is_snan,
246"is_snan($self, /)\n--\n\n\
247Return True if the argument is a signaling NaN and False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100248\n");
249
Stefan Krah5de1f822014-05-01 15:53:42 +0200250PyDoc_STRVAR(doc_is_subnormal,
251"is_subnormal($self, /, context=None)\n--\n\n\
252Return True if the argument is subnormal, and False otherwise. A number is\n\
253subnormal if it is non-zero, finite, and has an adjusted exponent less\n\
254than Emin.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100255\n");
256
Stefan Krah5de1f822014-05-01 15:53:42 +0200257PyDoc_STRVAR(doc_is_zero,
258"is_zero($self, /)\n--\n\n\
259Return True if the argument is a (positive or negative) zero and False\n\
260otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100261\n");
262
Stefan Krah5de1f822014-05-01 15:53:42 +0200263PyDoc_STRVAR(doc_ln,
264"ln($self, /, context=None)\n--\n\n\
265Return the natural (base e) logarithm of the operand. The function always\n\
266uses the ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100267\n");
268
Stefan Krah5de1f822014-05-01 15:53:42 +0200269PyDoc_STRVAR(doc_log10,
270"log10($self, /, context=None)\n--\n\n\
271Return the base ten logarithm of the operand. The function always uses the\n\
272ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100273\n");
274
Stefan Krah5de1f822014-05-01 15:53:42 +0200275PyDoc_STRVAR(doc_logb,
276"logb($self, /, context=None)\n--\n\n\
277For a non-zero number, return the adjusted exponent of the operand as a\n\
278Decimal instance. If the operand is a zero, then Decimal('-Infinity') is\n\
279returned and the DivisionByZero condition is raised. If the operand is\n\
280an infinity then Decimal('Infinity') is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100281\n");
282
Stefan Krah5de1f822014-05-01 15:53:42 +0200283PyDoc_STRVAR(doc_logical_and,
284"logical_and($self, /, other, context=None)\n--\n\n\
285Return the digit-wise 'and' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100286\n");
287
Stefan Krah5de1f822014-05-01 15:53:42 +0200288PyDoc_STRVAR(doc_logical_invert,
289"logical_invert($self, /, context=None)\n--\n\n\
290Return the digit-wise inversion of the (logical) operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100291\n");
292
Stefan Krah5de1f822014-05-01 15:53:42 +0200293PyDoc_STRVAR(doc_logical_or,
294"logical_or($self, /, other, context=None)\n--\n\n\
295Return the digit-wise 'or' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100296\n");
297
Stefan Krah5de1f822014-05-01 15:53:42 +0200298PyDoc_STRVAR(doc_logical_xor,
299"logical_xor($self, /, other, context=None)\n--\n\n\
300Return the digit-wise 'exclusive or' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100301\n");
302
Stefan Krah5de1f822014-05-01 15:53:42 +0200303PyDoc_STRVAR(doc_max,
304"max($self, /, other, context=None)\n--\n\n\
305Maximum of self and other. If one operand is a quiet NaN and the other is\n\
306numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100307\n");
308
Stefan Krah5de1f822014-05-01 15:53:42 +0200309PyDoc_STRVAR(doc_max_mag,
310"max_mag($self, /, other, context=None)\n--\n\n\
311Similar to the max() method, but the comparison is done using the absolute\n\
312values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100313\n");
314
Stefan Krah5de1f822014-05-01 15:53:42 +0200315PyDoc_STRVAR(doc_min,
316"min($self, /, other, context=None)\n--\n\n\
317Minimum of self and other. If one operand is a quiet NaN and the other is\n\
318numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100319\n");
320
Stefan Krah5de1f822014-05-01 15:53:42 +0200321PyDoc_STRVAR(doc_min_mag,
322"min_mag($self, /, other, context=None)\n--\n\n\
323Similar to the min() method, but the comparison is done using the absolute\n\
324values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100325\n");
326
Stefan Krah5de1f822014-05-01 15:53:42 +0200327PyDoc_STRVAR(doc_next_minus,
328"next_minus($self, /, context=None)\n--\n\n\
329Return the largest number representable in the given context (or in the\n\
330current default context if no context is given) that is smaller than the\n\
331given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100332\n");
333
Stefan Krah5de1f822014-05-01 15:53:42 +0200334PyDoc_STRVAR(doc_next_plus,
335"next_plus($self, /, context=None)\n--\n\n\
336Return the smallest number representable in the given context (or in the\n\
337current default context if no context is given) that is larger than the\n\
338given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100339\n");
340
Stefan Krah5de1f822014-05-01 15:53:42 +0200341PyDoc_STRVAR(doc_next_toward,
342"next_toward($self, /, other, context=None)\n--\n\n\
343If the two operands are unequal, return the number closest to the first\n\
344operand in the direction of the second operand. If both operands are\n\
345numerically equal, return a copy of the first operand with the sign set\n\
346to be the same as the sign of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100347\n");
348
Stefan Krah5de1f822014-05-01 15:53:42 +0200349PyDoc_STRVAR(doc_normalize,
350"normalize($self, /, context=None)\n--\n\n\
351Normalize the number by stripping the rightmost trailing zeros and\n\
352converting any result equal to Decimal('0') to Decimal('0e0'). Used\n\
353for producing canonical values for members of an equivalence class.\n\
354For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize\n\
355to the equivalent value Decimal('32.1').\n\
356\n");
357
358PyDoc_STRVAR(doc_number_class,
359"number_class($self, /, context=None)\n--\n\n\
360Return a string describing the class of the operand. The returned value\n\
361is one of the following ten strings:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100362\n\
363 * '-Infinity', indicating that the operand is negative infinity.\n\
364 * '-Normal', indicating that the operand is a negative normal number.\n\
365 * '-Subnormal', indicating that the operand is negative and subnormal.\n\
366 * '-Zero', indicating that the operand is a negative zero.\n\
367 * '+Zero', indicating that the operand is a positive zero.\n\
368 * '+Subnormal', indicating that the operand is positive and subnormal.\n\
369 * '+Normal', indicating that the operand is a positive normal number.\n\
370 * '+Infinity', indicating that the operand is positive infinity.\n\
371 * 'NaN', indicating that the operand is a quiet NaN (Not a Number).\n\
372 * 'sNaN', indicating that the operand is a signaling NaN.\n\
373\n\
374\n");
375
Stefan Krah5de1f822014-05-01 15:53:42 +0200376PyDoc_STRVAR(doc_quantize,
377"quantize($self, /, exp, rounding=None, context=None)\n--\n\n\
378Return a value equal to the first operand after rounding and having the\n\
379exponent of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100380\n\
381 >>> Decimal('1.41421356').quantize(Decimal('1.000'))\n\
382 Decimal('1.414')\n\
383\n\
384Unlike other operations, if the length of the coefficient after the quantize\n\
385operation would be greater than precision, then an InvalidOperation is signaled.\n\
386This guarantees that, unless there is an error condition, the quantized exponent\n\
387is always equal to that of the right-hand operand.\n\
388\n\
389Also unlike other operations, quantize never signals Underflow, even if the\n\
390result is subnormal and inexact.\n\
391\n\
392If the exponent of the second operand is larger than that of the first, then\n\
393rounding may be necessary. In this case, the rounding mode is determined by the\n\
394rounding argument if given, else by the given context argument; if neither\n\
395argument is given, the rounding mode of the current thread's context is used.\n\
396\n");
397
Stefan Krah5de1f822014-05-01 15:53:42 +0200398PyDoc_STRVAR(doc_radix,
399"radix($self, /)\n--\n\n\
400Return Decimal(10), the radix (base) in which the Decimal class does\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100401all its arithmetic. Included for compatibility with the specification.\n\
402\n");
403
Stefan Krah5de1f822014-05-01 15:53:42 +0200404PyDoc_STRVAR(doc_remainder_near,
405"remainder_near($self, /, other, context=None)\n--\n\n\
406Return the remainder from dividing self by other. This differs from\n\
407self % other in that the sign of the remainder is chosen so as to minimize\n\
408its absolute value. More precisely, the return value is self - n * other\n\
409where n is the integer nearest to the exact value of self / other, and\n\
410if two integers are equally near then the even one is chosen.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100411\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100412If the result is zero then its sign will be the sign of self.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100413\n");
414
Stefan Krah5de1f822014-05-01 15:53:42 +0200415PyDoc_STRVAR(doc_rotate,
416"rotate($self, /, other, context=None)\n--\n\n\
417Return the result of rotating the digits of the first operand by an amount\n\
418specified by the second operand. The second operand must be an integer in\n\
419the range -precision through precision. The absolute value of the second\n\
420operand gives the number of places to rotate. If the second operand is\n\
421positive then rotation is to the left; otherwise rotation is to the right.\n\
422The coefficient of the first operand is padded on the left with zeros to\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100423length precision if necessary. The sign and exponent of the first operand are\n\
424unchanged.\n\
425\n");
426
Stefan Krah5de1f822014-05-01 15:53:42 +0200427PyDoc_STRVAR(doc_same_quantum,
428"same_quantum($self, /, other, context=None)\n--\n\n\
429Test whether self and other have the same exponent or whether both are NaN.\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100430\n\
431This operation is unaffected by context and is quiet: no flags are changed\n\
432and no rounding is performed. As an exception, the C version may raise\n\
433InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100434\n");
435
Stefan Krah5de1f822014-05-01 15:53:42 +0200436PyDoc_STRVAR(doc_scaleb,
437"scaleb($self, /, other, context=None)\n--\n\n\
438Return the first operand with the exponent adjusted the second. Equivalently,\n\
439return the first operand multiplied by 10**other. The second operand must be\n\
440an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100441\n");
442
Stefan Krah5de1f822014-05-01 15:53:42 +0200443PyDoc_STRVAR(doc_shift,
444"shift($self, /, other, context=None)\n--\n\n\
445Return the result of shifting the digits of the first operand by an amount\n\
446specified by the second operand. The second operand must be an integer in\n\
447the range -precision through precision. The absolute value of the second\n\
448operand gives the number of places to shift. If the second operand is\n\
449positive, then the shift is to the left; otherwise the shift is to the\n\
450right. Digits shifted into the coefficient are zeros. The sign and exponent\n\
451of the first operand are unchanged.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100452\n");
453
Stefan Krah5de1f822014-05-01 15:53:42 +0200454PyDoc_STRVAR(doc_sqrt,
455"sqrt($self, /, context=None)\n--\n\n\
456Return the square root of the argument to full precision. The result is\n\
457correctly rounded using the ROUND_HALF_EVEN rounding mode.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100458\n");
459
Stefan Krah5de1f822014-05-01 15:53:42 +0200460PyDoc_STRVAR(doc_to_eng_string,
461"to_eng_string($self, /, context=None)\n--\n\n\
462Convert to an engineering-type string. Engineering notation has an exponent\n\
463which is a multiple of 3, so there are up to 3 digits left of the decimal\n\
464place. For example, Decimal('123E+1') is converted to Decimal('1.23E+3').\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100465\n\
466The value of context.capitals determines whether the exponent sign is lower\n\
467or upper case. Otherwise, the context does not affect the operation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100468\n");
469
Stefan Krah5de1f822014-05-01 15:53:42 +0200470PyDoc_STRVAR(doc_to_integral,
471"to_integral($self, /, rounding=None, context=None)\n--\n\n\
472Identical to the to_integral_value() method. The to_integral() name has been\n\
473kept for compatibility with older versions.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100474\n");
475
Stefan Krah5de1f822014-05-01 15:53:42 +0200476PyDoc_STRVAR(doc_to_integral_exact,
477"to_integral_exact($self, /, rounding=None, context=None)\n--\n\n\
478Round to the nearest integer, signaling Inexact or Rounded as appropriate if\n\
479rounding occurs. The rounding mode is determined by the rounding parameter\n\
480if given, else by the given context. If neither parameter is given, then the\n\
481rounding mode of the current default context is used.\n\
482\n");
483
484PyDoc_STRVAR(doc_to_integral_value,
485"to_integral_value($self, /, rounding=None, context=None)\n--\n\n\
486Round to the nearest integer without signaling Inexact or Rounded. The\n\
487rounding mode is determined by the rounding parameter if given, else by\n\
488the given context. If neither parameter is given, then the rounding mode\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100489of the current default context is used.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100490\n");
491
Stefan Krah1919b7e2012-03-21 18:25:23 +0100492
493/******************************************************************************/
494/* Context Object and Methods */
495/******************************************************************************/
496
Stefan Krah5de1f822014-05-01 15:53:42 +0200497PyDoc_STRVAR(doc_context,
498"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 +0100499The context affects almost all operations and controls rounding,\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200500Over/Underflow, raising of exceptions and much more. A new context\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100501can be constructed as follows:\n\
502\n\
503 >>> c = Context(prec=28, Emin=-425000000, Emax=425000000,\n\
504 ... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,\n\
505 ... traps=[InvalidOperation, DivisionByZero, Overflow],\n\
506 ... flags=[])\n\
507 >>>\n\
508\n\
509\n");
510
511#ifdef EXTRA_FUNCTIONALITY
Stefan Krah5de1f822014-05-01 15:53:42 +0200512PyDoc_STRVAR(doc_ctx_apply,
513"apply($self, x, /)\n--\n\n\
514Apply self to Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100515\n");
516#endif
517
Stefan Krah5de1f822014-05-01 15:53:42 +0200518PyDoc_STRVAR(doc_ctx_clear_flags,
519"clear_flags($self, /)\n--\n\n\
520Reset all flags to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100521\n");
522
Stefan Krah5de1f822014-05-01 15:53:42 +0200523PyDoc_STRVAR(doc_ctx_clear_traps,
524"clear_traps($self, /)\n--\n\n\
525Set all traps to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100526\n");
527
Stefan Krah5de1f822014-05-01 15:53:42 +0200528PyDoc_STRVAR(doc_ctx_copy,
529"copy($self, /)\n--\n\n\
530Return a duplicate of the context with all flags cleared.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100531\n");
532
Stefan Krah5de1f822014-05-01 15:53:42 +0200533PyDoc_STRVAR(doc_ctx_copy_decimal,
534"copy_decimal($self, x, /)\n--\n\n\
535Return a copy of Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100536\n");
537
Stefan Krah5de1f822014-05-01 15:53:42 +0200538PyDoc_STRVAR(doc_ctx_create_decimal,
539"create_decimal($self, num=\"0\", /)\n--\n\n\
540Create a new Decimal instance from num, using self as the context. Unlike the\n\
541Decimal constructor, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100542\n");
543
Stefan Krah5de1f822014-05-01 15:53:42 +0200544PyDoc_STRVAR(doc_ctx_create_decimal_from_float,
545"create_decimal_from_float($self, f, /)\n--\n\n\
546Create a new Decimal instance from float f. Unlike the Decimal.from_float()\n\
547class method, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100548\n");
549
Stefan Krah5de1f822014-05-01 15:53:42 +0200550PyDoc_STRVAR(doc_ctx_Etiny,
551"Etiny($self, /)\n--\n\n\
552Return a value equal to Emin - prec + 1, which is the minimum exponent value\n\
553for subnormal results. When underflow occurs, the exponent is set to Etiny.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100554\n");
555
Stefan Krah5de1f822014-05-01 15:53:42 +0200556PyDoc_STRVAR(doc_ctx_Etop,
557"Etop($self, /)\n--\n\n\
558Return a value equal to Emax - prec + 1. This is the maximum exponent\n\
559if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop()\n\
560must not be negative.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100561\n");
562
Stefan Krah5de1f822014-05-01 15:53:42 +0200563PyDoc_STRVAR(doc_ctx_abs,
564"abs($self, x, /)\n--\n\n\
565Return the absolute value of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100566\n");
567
Stefan Krah5de1f822014-05-01 15:53:42 +0200568PyDoc_STRVAR(doc_ctx_add,
569"add($self, x, y, /)\n--\n\n\
570Return the sum of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100571\n");
572
Stefan Krah5de1f822014-05-01 15:53:42 +0200573PyDoc_STRVAR(doc_ctx_canonical,
574"canonical($self, x, /)\n--\n\n\
575Return a new instance of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100576\n");
577
Stefan Krah5de1f822014-05-01 15:53:42 +0200578PyDoc_STRVAR(doc_ctx_compare,
579"compare($self, x, y, /)\n--\n\n\
580Compare x and y numerically.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100581\n");
582
Stefan Krah5de1f822014-05-01 15:53:42 +0200583PyDoc_STRVAR(doc_ctx_compare_signal,
584"compare_signal($self, x, y, /)\n--\n\n\
585Compare x and y numerically. All NaNs signal.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100586\n");
587
Stefan Krah5de1f822014-05-01 15:53:42 +0200588PyDoc_STRVAR(doc_ctx_compare_total,
589"compare_total($self, x, y, /)\n--\n\n\
590Compare x and y using their abstract representation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100591\n");
592
Stefan Krah5de1f822014-05-01 15:53:42 +0200593PyDoc_STRVAR(doc_ctx_compare_total_mag,
594"compare_total_mag($self, x, y, /)\n--\n\n\
595Compare x and y using their abstract representation, ignoring sign.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100596\n");
597
Stefan Krah5de1f822014-05-01 15:53:42 +0200598PyDoc_STRVAR(doc_ctx_copy_abs,
599"copy_abs($self, x, /)\n--\n\n\
600Return a copy of x with the sign set to 0.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100601\n");
602
Stefan Krah5de1f822014-05-01 15:53:42 +0200603PyDoc_STRVAR(doc_ctx_copy_negate,
604"copy_negate($self, x, /)\n--\n\n\
605Return a copy of x with the sign inverted.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100606\n");
607
Stefan Krah5de1f822014-05-01 15:53:42 +0200608PyDoc_STRVAR(doc_ctx_copy_sign,
609"copy_sign($self, x, y, /)\n--\n\n\
610Copy the sign from y to x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100611\n");
612
Stefan Krah5de1f822014-05-01 15:53:42 +0200613PyDoc_STRVAR(doc_ctx_divide,
614"divide($self, x, y, /)\n--\n\n\
615Return x divided by y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100616\n");
617
Stefan Krah5de1f822014-05-01 15:53:42 +0200618PyDoc_STRVAR(doc_ctx_divide_int,
619"divide_int($self, x, y, /)\n--\n\n\
620Return x divided by y, truncated to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100621\n");
622
Stefan Krah5de1f822014-05-01 15:53:42 +0200623PyDoc_STRVAR(doc_ctx_divmod,
624"divmod($self, x, y, /)\n--\n\n\
625Return quotient and remainder of the division x / y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100626\n");
627
Stefan Krah5de1f822014-05-01 15:53:42 +0200628PyDoc_STRVAR(doc_ctx_exp,
629"exp($self, x, /)\n--\n\n\
630Return e ** x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100631\n");
632
Stefan Krah5de1f822014-05-01 15:53:42 +0200633PyDoc_STRVAR(doc_ctx_fma,
634"fma($self, x, y, z, /)\n--\n\n\
635Return x multiplied by y, plus z.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100636\n");
637
Stefan Krah5de1f822014-05-01 15:53:42 +0200638PyDoc_STRVAR(doc_ctx_is_canonical,
639"is_canonical($self, x, /)\n--\n\n\
640Return True if x is canonical, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100641\n");
642
Stefan Krah5de1f822014-05-01 15:53:42 +0200643PyDoc_STRVAR(doc_ctx_is_finite,
644"is_finite($self, x, /)\n--\n\n\
645Return True if x is finite, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100646\n");
647
Stefan Krah5de1f822014-05-01 15:53:42 +0200648PyDoc_STRVAR(doc_ctx_is_infinite,
649"is_infinite($self, x, /)\n--\n\n\
650Return True if x is infinite, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100651\n");
652
Stefan Krah5de1f822014-05-01 15:53:42 +0200653PyDoc_STRVAR(doc_ctx_is_nan,
654"is_nan($self, x, /)\n--\n\n\
655Return True if x is a qNaN or sNaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100656\n");
657
Stefan Krah5de1f822014-05-01 15:53:42 +0200658PyDoc_STRVAR(doc_ctx_is_normal,
659"is_normal($self, x, /)\n--\n\n\
660Return True if x is a normal number, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100661\n");
662
Stefan Krah5de1f822014-05-01 15:53:42 +0200663PyDoc_STRVAR(doc_ctx_is_qnan,
664"is_qnan($self, x, /)\n--\n\n\
665Return True if x is a quiet NaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100666\n");
667
Stefan Krah5de1f822014-05-01 15:53:42 +0200668PyDoc_STRVAR(doc_ctx_is_signed,
669"is_signed($self, x, /)\n--\n\n\
670Return True if x is negative, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100671\n");
672
Stefan Krah5de1f822014-05-01 15:53:42 +0200673PyDoc_STRVAR(doc_ctx_is_snan,
674"is_snan($self, x, /)\n--\n\n\
675Return True if x is a signaling NaN, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100676\n");
677
Stefan Krah5de1f822014-05-01 15:53:42 +0200678PyDoc_STRVAR(doc_ctx_is_subnormal,
679"is_subnormal($self, x, /)\n--\n\n\
680Return True if x is subnormal, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100681\n");
682
Stefan Krah5de1f822014-05-01 15:53:42 +0200683PyDoc_STRVAR(doc_ctx_is_zero,
684"is_zero($self, x, /)\n--\n\n\
685Return True if x is a zero, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100686\n");
687
Stefan Krah5de1f822014-05-01 15:53:42 +0200688PyDoc_STRVAR(doc_ctx_ln,
689"ln($self, x, /)\n--\n\n\
690Return the natural (base e) logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100691\n");
692
Stefan Krah5de1f822014-05-01 15:53:42 +0200693PyDoc_STRVAR(doc_ctx_log10,
694"log10($self, x, /)\n--\n\n\
695Return the base 10 logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100696\n");
697
Stefan Krah5de1f822014-05-01 15:53:42 +0200698PyDoc_STRVAR(doc_ctx_logb,
699"logb($self, x, /)\n--\n\n\
700Return the exponent of the magnitude of the operand's MSD.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100701\n");
702
Stefan Krah5de1f822014-05-01 15:53:42 +0200703PyDoc_STRVAR(doc_ctx_logical_and,
704"logical_and($self, x, y, /)\n--\n\n\
705Digit-wise and of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100706\n");
707
Stefan Krah5de1f822014-05-01 15:53:42 +0200708PyDoc_STRVAR(doc_ctx_logical_invert,
709"logical_invert($self, x, /)\n--\n\n\
710Invert all digits of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100711\n");
712
Stefan Krah5de1f822014-05-01 15:53:42 +0200713PyDoc_STRVAR(doc_ctx_logical_or,
714"logical_or($self, x, y, /)\n--\n\n\
715Digit-wise or of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100716\n");
717
Stefan Krah5de1f822014-05-01 15:53:42 +0200718PyDoc_STRVAR(doc_ctx_logical_xor,
719"logical_xor($self, x, y, /)\n--\n\n\
720Digit-wise xor of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100721\n");
722
Stefan Krah5de1f822014-05-01 15:53:42 +0200723PyDoc_STRVAR(doc_ctx_max,
724"max($self, x, y, /)\n--\n\n\
725Compare the values numerically and return the maximum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100726\n");
727
Stefan Krah5de1f822014-05-01 15:53:42 +0200728PyDoc_STRVAR(doc_ctx_max_mag,
729"max_mag($self, x, y, /)\n--\n\n\
730Compare the values numerically with their sign ignored.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100731\n");
732
Stefan Krah5de1f822014-05-01 15:53:42 +0200733PyDoc_STRVAR(doc_ctx_min,
734"min($self, x, y, /)\n--\n\n\
735Compare the values numerically and return the minimum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100736\n");
737
Stefan Krah5de1f822014-05-01 15:53:42 +0200738PyDoc_STRVAR(doc_ctx_min_mag,
739"min_mag($self, x, y, /)\n--\n\n\
740Compare the values numerically with their sign ignored.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100741\n");
742
Stefan Krah5de1f822014-05-01 15:53:42 +0200743PyDoc_STRVAR(doc_ctx_minus,
744"minus($self, x, /)\n--\n\n\
745Minus corresponds to the unary prefix minus operator in Python, but applies\n\
746the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100747\n");
748
Stefan Krah5de1f822014-05-01 15:53:42 +0200749PyDoc_STRVAR(doc_ctx_multiply,
750"multiply($self, x, y, /)\n--\n\n\
751Return the product of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100752\n");
753
Stefan Krah5de1f822014-05-01 15:53:42 +0200754PyDoc_STRVAR(doc_ctx_next_minus,
755"next_minus($self, x, /)\n--\n\n\
756Return the largest representable number smaller than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100757\n");
758
Stefan Krah5de1f822014-05-01 15:53:42 +0200759PyDoc_STRVAR(doc_ctx_next_plus,
760"next_plus($self, x, /)\n--\n\n\
761Return the smallest representable number larger than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100762\n");
763
Stefan Krah5de1f822014-05-01 15:53:42 +0200764PyDoc_STRVAR(doc_ctx_next_toward,
765"next_toward($self, x, y, /)\n--\n\n\
766Return the number closest to x, in the direction towards y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100767\n");
768
Stefan Krah5de1f822014-05-01 15:53:42 +0200769PyDoc_STRVAR(doc_ctx_normalize,
770"normalize($self, x, /)\n--\n\n\
771Reduce x to its simplest form. Alias for reduce(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100772\n");
773
Stefan Krah5de1f822014-05-01 15:53:42 +0200774PyDoc_STRVAR(doc_ctx_number_class,
775"number_class($self, x, /)\n--\n\n\
776Return an indication of the class of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100777\n");
778
Stefan Krah5de1f822014-05-01 15:53:42 +0200779PyDoc_STRVAR(doc_ctx_plus,
780"plus($self, x, /)\n--\n\n\
781Plus corresponds to the unary prefix plus operator in Python, but applies\n\
782the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100783\n");
784
Stefan Krah5de1f822014-05-01 15:53:42 +0200785PyDoc_STRVAR(doc_ctx_power,
786"power($self, /, a, b, modulo=None)\n--\n\n\
787Compute a**b. If 'a' is negative, then 'b' must be integral. The result\n\
788will be inexact unless 'a' is integral and the result is finite and can\n\
789be expressed exactly in 'precision' digits. In the Python version the\n\
790result is always correctly rounded, in the C version the result is almost\n\
791always correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100792\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200793If modulo is given, compute (a**b) % modulo. The following restrictions\n\
794hold:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100795\n\
796 * all three arguments must be integral\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200797 * 'b' must be nonnegative\n\
798 * at least one of 'a' or 'b' must be nonzero\n\
799 * modulo must be nonzero and less than 10**prec in absolute value\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100800\n\
801\n");
802
Stefan Krah5de1f822014-05-01 15:53:42 +0200803PyDoc_STRVAR(doc_ctx_quantize,
804"quantize($self, x, y, /)\n--\n\n\
805Return a value equal to x (rounded), having the exponent of y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100806\n");
807
Stefan Krah5de1f822014-05-01 15:53:42 +0200808PyDoc_STRVAR(doc_ctx_radix,
809"radix($self, /)\n--\n\n\
810Return 10.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100811\n");
812
Stefan Krah5de1f822014-05-01 15:53:42 +0200813PyDoc_STRVAR(doc_ctx_remainder,
814"remainder($self, x, y, /)\n--\n\n\
815Return the remainder from integer division. The sign of the result,\n\
816if non-zero, is the same as that of the original dividend.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100817\n");
818
Stefan Krah5de1f822014-05-01 15:53:42 +0200819PyDoc_STRVAR(doc_ctx_remainder_near,
820"remainder_near($self, x, y, /)\n--\n\n\
821Return x - y * n, where n is the integer nearest the exact value of x / y\n\
822(if the result is 0 then its sign will be the sign of x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100823\n");
824
Stefan Krah5de1f822014-05-01 15:53:42 +0200825PyDoc_STRVAR(doc_ctx_rotate,
826"rotate($self, x, y, /)\n--\n\n\
827Return a copy of x, rotated by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100828\n");
829
Stefan Krah5de1f822014-05-01 15:53:42 +0200830PyDoc_STRVAR(doc_ctx_same_quantum,
831"same_quantum($self, x, y, /)\n--\n\n\
832Return True if the two operands have the same exponent.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100833\n");
834
Stefan Krah5de1f822014-05-01 15:53:42 +0200835PyDoc_STRVAR(doc_ctx_scaleb,
836"scaleb($self, x, y, /)\n--\n\n\
837Return the first operand after adding the second value to its exp.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100838\n");
839
Stefan Krah5de1f822014-05-01 15:53:42 +0200840PyDoc_STRVAR(doc_ctx_shift,
841"shift($self, x, y, /)\n--\n\n\
842Return a copy of x, shifted by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100843\n");
844
Stefan Krah5de1f822014-05-01 15:53:42 +0200845PyDoc_STRVAR(doc_ctx_sqrt,
846"sqrt($self, x, /)\n--\n\n\
847Square root of a non-negative number to context precision.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100848\n");
849
Stefan Krah5de1f822014-05-01 15:53:42 +0200850PyDoc_STRVAR(doc_ctx_subtract,
851"subtract($self, x, y, /)\n--\n\n\
852Return the difference between x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100853\n");
854
Stefan Krah5de1f822014-05-01 15:53:42 +0200855PyDoc_STRVAR(doc_ctx_to_eng_string,
856"to_eng_string($self, x, /)\n--\n\n\
857Convert a number to a string, using engineering notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100858\n");
859
Stefan Krah5de1f822014-05-01 15:53:42 +0200860PyDoc_STRVAR(doc_ctx_to_integral,
861"to_integral($self, x, /)\n--\n\n\
862Identical to to_integral_value(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100863\n");
864
Stefan Krah5de1f822014-05-01 15:53:42 +0200865PyDoc_STRVAR(doc_ctx_to_integral_exact,
866"to_integral_exact($self, x, /)\n--\n\n\
867Round to an integer. Signal if the result is rounded or inexact.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100868\n");
869
Stefan Krah5de1f822014-05-01 15:53:42 +0200870PyDoc_STRVAR(doc_ctx_to_integral_value,
871"to_integral_value($self, x, /)\n--\n\n\
872Round to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100873\n");
874
Stefan Krah5de1f822014-05-01 15:53:42 +0200875PyDoc_STRVAR(doc_ctx_to_sci_string,
876"to_sci_string($self, x, /)\n--\n\n\
877Convert a number to a string using scientific notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100878\n");
879
880
881#endif /* DOCSTRINGS_H */
882
883
884