blob: bd602ab278e0edd7eb281234c4b444421d7ff2bb [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
Robert Smallshire58a7da92020-10-01 18:30:08 +0200263PyDoc_STRVAR(doc_is_integer,
264"is_integer($self, /)\n--\n\n\
265Return True if the argument is finite and integral, otherwise False.\n\
266\n");
267
Stefan Krah5de1f822014-05-01 15:53:42 +0200268PyDoc_STRVAR(doc_ln,
269"ln($self, /, context=None)\n--\n\n\
270Return the natural (base e) logarithm of the operand. The function always\n\
271uses the ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100272\n");
273
Stefan Krah5de1f822014-05-01 15:53:42 +0200274PyDoc_STRVAR(doc_log10,
275"log10($self, /, context=None)\n--\n\n\
276Return the base ten logarithm of the operand. The function always uses the\n\
277ROUND_HALF_EVEN mode and the result is correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100278\n");
279
Stefan Krah5de1f822014-05-01 15:53:42 +0200280PyDoc_STRVAR(doc_logb,
281"logb($self, /, context=None)\n--\n\n\
282For a non-zero number, return the adjusted exponent of the operand as a\n\
283Decimal instance. If the operand is a zero, then Decimal('-Infinity') is\n\
284returned and the DivisionByZero condition is raised. If the operand is\n\
285an infinity then Decimal('Infinity') is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100286\n");
287
Stefan Krah5de1f822014-05-01 15:53:42 +0200288PyDoc_STRVAR(doc_logical_and,
289"logical_and($self, /, other, context=None)\n--\n\n\
290Return the digit-wise 'and' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100291\n");
292
Stefan Krah5de1f822014-05-01 15:53:42 +0200293PyDoc_STRVAR(doc_logical_invert,
294"logical_invert($self, /, context=None)\n--\n\n\
295Return the digit-wise inversion of the (logical) operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100296\n");
297
Stefan Krah5de1f822014-05-01 15:53:42 +0200298PyDoc_STRVAR(doc_logical_or,
299"logical_or($self, /, other, context=None)\n--\n\n\
300Return the digit-wise '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_logical_xor,
304"logical_xor($self, /, other, context=None)\n--\n\n\
305Return the digit-wise 'exclusive or' of the two (logical) operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100306\n");
307
Stefan Krah5de1f822014-05-01 15:53:42 +0200308PyDoc_STRVAR(doc_max,
309"max($self, /, other, context=None)\n--\n\n\
310Maximum of self and other. If one operand is a quiet NaN and the other is\n\
311numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100312\n");
313
Stefan Krah5de1f822014-05-01 15:53:42 +0200314PyDoc_STRVAR(doc_max_mag,
315"max_mag($self, /, other, context=None)\n--\n\n\
316Similar to the max() method, but the comparison is done using the absolute\n\
317values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100318\n");
319
Stefan Krah5de1f822014-05-01 15:53:42 +0200320PyDoc_STRVAR(doc_min,
321"min($self, /, other, context=None)\n--\n\n\
322Minimum of self and other. If one operand is a quiet NaN and the other is\n\
323numeric, the numeric operand is returned.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100324\n");
325
Stefan Krah5de1f822014-05-01 15:53:42 +0200326PyDoc_STRVAR(doc_min_mag,
327"min_mag($self, /, other, context=None)\n--\n\n\
328Similar to the min() method, but the comparison is done using the absolute\n\
329values of the operands.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100330\n");
331
Stefan Krah5de1f822014-05-01 15:53:42 +0200332PyDoc_STRVAR(doc_next_minus,
333"next_minus($self, /, context=None)\n--\n\n\
334Return the largest number representable in the given context (or in the\n\
335current default context if no context is given) that is smaller than the\n\
336given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100337\n");
338
Stefan Krah5de1f822014-05-01 15:53:42 +0200339PyDoc_STRVAR(doc_next_plus,
340"next_plus($self, /, context=None)\n--\n\n\
341Return the smallest number representable in the given context (or in the\n\
342current default context if no context is given) that is larger than the\n\
343given operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100344\n");
345
Stefan Krah5de1f822014-05-01 15:53:42 +0200346PyDoc_STRVAR(doc_next_toward,
347"next_toward($self, /, other, context=None)\n--\n\n\
348If the two operands are unequal, return the number closest to the first\n\
349operand in the direction of the second operand. If both operands are\n\
350numerically equal, return a copy of the first operand with the sign set\n\
351to be the same as the sign of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100352\n");
353
Stefan Krah5de1f822014-05-01 15:53:42 +0200354PyDoc_STRVAR(doc_normalize,
355"normalize($self, /, context=None)\n--\n\n\
356Normalize the number by stripping the rightmost trailing zeros and\n\
357converting any result equal to Decimal('0') to Decimal('0e0'). Used\n\
358for producing canonical values for members of an equivalence class.\n\
359For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize\n\
360to the equivalent value Decimal('32.1').\n\
361\n");
362
363PyDoc_STRVAR(doc_number_class,
364"number_class($self, /, context=None)\n--\n\n\
365Return a string describing the class of the operand. The returned value\n\
366is one of the following ten strings:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100367\n\
368 * '-Infinity', indicating that the operand is negative infinity.\n\
369 * '-Normal', indicating that the operand is a negative normal number.\n\
370 * '-Subnormal', indicating that the operand is negative and subnormal.\n\
371 * '-Zero', indicating that the operand is a negative zero.\n\
372 * '+Zero', indicating that the operand is a positive zero.\n\
373 * '+Subnormal', indicating that the operand is positive and subnormal.\n\
374 * '+Normal', indicating that the operand is a positive normal number.\n\
375 * '+Infinity', indicating that the operand is positive infinity.\n\
376 * 'NaN', indicating that the operand is a quiet NaN (Not a Number).\n\
377 * 'sNaN', indicating that the operand is a signaling NaN.\n\
378\n\
379\n");
380
Stefan Krah5de1f822014-05-01 15:53:42 +0200381PyDoc_STRVAR(doc_quantize,
382"quantize($self, /, exp, rounding=None, context=None)\n--\n\n\
383Return a value equal to the first operand after rounding and having the\n\
384exponent of the second operand.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100385\n\
386 >>> Decimal('1.41421356').quantize(Decimal('1.000'))\n\
387 Decimal('1.414')\n\
388\n\
389Unlike other operations, if the length of the coefficient after the quantize\n\
390operation would be greater than precision, then an InvalidOperation is signaled.\n\
391This guarantees that, unless there is an error condition, the quantized exponent\n\
392is always equal to that of the right-hand operand.\n\
393\n\
394Also unlike other operations, quantize never signals Underflow, even if the\n\
395result is subnormal and inexact.\n\
396\n\
397If the exponent of the second operand is larger than that of the first, then\n\
398rounding may be necessary. In this case, the rounding mode is determined by the\n\
399rounding argument if given, else by the given context argument; if neither\n\
400argument is given, the rounding mode of the current thread's context is used.\n\
401\n");
402
Stefan Krah5de1f822014-05-01 15:53:42 +0200403PyDoc_STRVAR(doc_radix,
404"radix($self, /)\n--\n\n\
405Return Decimal(10), the radix (base) in which the Decimal class does\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100406all its arithmetic. Included for compatibility with the specification.\n\
407\n");
408
Stefan Krah5de1f822014-05-01 15:53:42 +0200409PyDoc_STRVAR(doc_remainder_near,
410"remainder_near($self, /, other, context=None)\n--\n\n\
411Return the remainder from dividing self by other. This differs from\n\
412self % other in that the sign of the remainder is chosen so as to minimize\n\
413its absolute value. More precisely, the return value is self - n * other\n\
414where n is the integer nearest to the exact value of self / other, and\n\
415if two integers are equally near then the even one is chosen.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100416\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100417If the result is zero then its sign will be the sign of self.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100418\n");
419
Stefan Krah5de1f822014-05-01 15:53:42 +0200420PyDoc_STRVAR(doc_rotate,
421"rotate($self, /, other, context=None)\n--\n\n\
422Return the result of rotating the digits of the first operand by an amount\n\
423specified by the second operand. The second operand must be an integer in\n\
424the range -precision through precision. The absolute value of the second\n\
425operand gives the number of places to rotate. If the second operand is\n\
426positive then rotation is to the left; otherwise rotation is to the right.\n\
427The coefficient of the first operand is padded on the left with zeros to\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100428length precision if necessary. The sign and exponent of the first operand are\n\
429unchanged.\n\
430\n");
431
Stefan Krah5de1f822014-05-01 15:53:42 +0200432PyDoc_STRVAR(doc_same_quantum,
433"same_quantum($self, /, other, context=None)\n--\n\n\
434Test whether self and other have the same exponent or whether both are NaN.\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100435\n\
436This operation is unaffected by context and is quiet: no flags are changed\n\
437and no rounding is performed. As an exception, the C version may raise\n\
438InvalidOperation if the second operand cannot be converted exactly.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100439\n");
440
Stefan Krah5de1f822014-05-01 15:53:42 +0200441PyDoc_STRVAR(doc_scaleb,
442"scaleb($self, /, other, context=None)\n--\n\n\
443Return the first operand with the exponent adjusted the second. Equivalently,\n\
444return the first operand multiplied by 10**other. The second operand must be\n\
445an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100446\n");
447
Stefan Krah5de1f822014-05-01 15:53:42 +0200448PyDoc_STRVAR(doc_shift,
449"shift($self, /, other, context=None)\n--\n\n\
450Return the result of shifting the digits of the first operand by an amount\n\
451specified by the second operand. The second operand must be an integer in\n\
452the range -precision through precision. The absolute value of the second\n\
453operand gives the number of places to shift. If the second operand is\n\
454positive, then the shift is to the left; otherwise the shift is to the\n\
455right. Digits shifted into the coefficient are zeros. The sign and exponent\n\
456of the first operand are unchanged.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100457\n");
458
Stefan Krah5de1f822014-05-01 15:53:42 +0200459PyDoc_STRVAR(doc_sqrt,
460"sqrt($self, /, context=None)\n--\n\n\
461Return the square root of the argument to full precision. The result is\n\
462correctly rounded using the ROUND_HALF_EVEN rounding mode.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100463\n");
464
Stefan Krah5de1f822014-05-01 15:53:42 +0200465PyDoc_STRVAR(doc_to_eng_string,
466"to_eng_string($self, /, context=None)\n--\n\n\
467Convert to an engineering-type string. Engineering notation has an exponent\n\
468which is a multiple of 3, so there are up to 3 digits left of the decimal\n\
469place. For example, Decimal('123E+1') is converted to Decimal('1.23E+3').\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100470\n\
471The value of context.capitals determines whether the exponent sign is lower\n\
472or upper case. Otherwise, the context does not affect the operation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100473\n");
474
Stefan Krah5de1f822014-05-01 15:53:42 +0200475PyDoc_STRVAR(doc_to_integral,
476"to_integral($self, /, rounding=None, context=None)\n--\n\n\
477Identical to the to_integral_value() method. The to_integral() name has been\n\
478kept for compatibility with older versions.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100479\n");
480
Stefan Krah5de1f822014-05-01 15:53:42 +0200481PyDoc_STRVAR(doc_to_integral_exact,
482"to_integral_exact($self, /, rounding=None, context=None)\n--\n\n\
483Round to the nearest integer, signaling Inexact or Rounded as appropriate if\n\
484rounding occurs. The rounding mode is determined by the rounding parameter\n\
485if given, else by the given context. If neither parameter is given, then the\n\
486rounding mode of the current default context is used.\n\
487\n");
488
489PyDoc_STRVAR(doc_to_integral_value,
490"to_integral_value($self, /, rounding=None, context=None)\n--\n\n\
491Round to the nearest integer without signaling Inexact or Rounded. The\n\
492rounding mode is determined by the rounding parameter if given, else by\n\
493the given context. If neither parameter is given, then the rounding mode\n\
Stefan Krah040e3112012-12-15 22:33:33 +0100494of the current default context is used.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100495\n");
496
Stefan Krah1919b7e2012-03-21 18:25:23 +0100497
498/******************************************************************************/
499/* Context Object and Methods */
500/******************************************************************************/
501
Stefan Krah5de1f822014-05-01 15:53:42 +0200502PyDoc_STRVAR(doc_context,
503"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 +0100504The context affects almost all operations and controls rounding,\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200505Over/Underflow, raising of exceptions and much more. A new context\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100506can be constructed as follows:\n\
507\n\
508 >>> c = Context(prec=28, Emin=-425000000, Emax=425000000,\n\
509 ... rounding=ROUND_HALF_EVEN, capitals=1, clamp=1,\n\
510 ... traps=[InvalidOperation, DivisionByZero, Overflow],\n\
511 ... flags=[])\n\
512 >>>\n\
513\n\
514\n");
515
516#ifdef EXTRA_FUNCTIONALITY
Stefan Krah5de1f822014-05-01 15:53:42 +0200517PyDoc_STRVAR(doc_ctx_apply,
518"apply($self, x, /)\n--\n\n\
519Apply self to Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100520\n");
521#endif
522
Stefan Krah5de1f822014-05-01 15:53:42 +0200523PyDoc_STRVAR(doc_ctx_clear_flags,
524"clear_flags($self, /)\n--\n\n\
525Reset all flags to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100526\n");
527
Stefan Krah5de1f822014-05-01 15:53:42 +0200528PyDoc_STRVAR(doc_ctx_clear_traps,
529"clear_traps($self, /)\n--\n\n\
530Set all traps to False.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100531\n");
532
Stefan Krah5de1f822014-05-01 15:53:42 +0200533PyDoc_STRVAR(doc_ctx_copy,
534"copy($self, /)\n--\n\n\
535Return a duplicate of the context with all flags cleared.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100536\n");
537
Stefan Krah5de1f822014-05-01 15:53:42 +0200538PyDoc_STRVAR(doc_ctx_copy_decimal,
539"copy_decimal($self, x, /)\n--\n\n\
540Return a copy of Decimal x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100541\n");
542
Stefan Krah5de1f822014-05-01 15:53:42 +0200543PyDoc_STRVAR(doc_ctx_create_decimal,
544"create_decimal($self, num=\"0\", /)\n--\n\n\
545Create a new Decimal instance from num, using self as the context. Unlike the\n\
546Decimal constructor, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100547\n");
548
Stefan Krah5de1f822014-05-01 15:53:42 +0200549PyDoc_STRVAR(doc_ctx_create_decimal_from_float,
550"create_decimal_from_float($self, f, /)\n--\n\n\
551Create a new Decimal instance from float f. Unlike the Decimal.from_float()\n\
552class method, this function observes the context limits.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100553\n");
554
Stefan Krah5de1f822014-05-01 15:53:42 +0200555PyDoc_STRVAR(doc_ctx_Etiny,
556"Etiny($self, /)\n--\n\n\
557Return a value equal to Emin - prec + 1, which is the minimum exponent value\n\
558for subnormal results. When underflow occurs, the exponent is set to Etiny.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100559\n");
560
Stefan Krah5de1f822014-05-01 15:53:42 +0200561PyDoc_STRVAR(doc_ctx_Etop,
562"Etop($self, /)\n--\n\n\
563Return a value equal to Emax - prec + 1. This is the maximum exponent\n\
564if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop()\n\
565must not be negative.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100566\n");
567
Stefan Krah5de1f822014-05-01 15:53:42 +0200568PyDoc_STRVAR(doc_ctx_abs,
569"abs($self, x, /)\n--\n\n\
570Return the absolute value of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100571\n");
572
Stefan Krah5de1f822014-05-01 15:53:42 +0200573PyDoc_STRVAR(doc_ctx_add,
574"add($self, x, y, /)\n--\n\n\
575Return the sum of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100576\n");
577
Stefan Krah5de1f822014-05-01 15:53:42 +0200578PyDoc_STRVAR(doc_ctx_canonical,
579"canonical($self, x, /)\n--\n\n\
580Return a new instance of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100581\n");
582
Stefan Krah5de1f822014-05-01 15:53:42 +0200583PyDoc_STRVAR(doc_ctx_compare,
584"compare($self, x, y, /)\n--\n\n\
585Compare x and y numerically.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100586\n");
587
Stefan Krah5de1f822014-05-01 15:53:42 +0200588PyDoc_STRVAR(doc_ctx_compare_signal,
589"compare_signal($self, x, y, /)\n--\n\n\
590Compare x and y numerically. All NaNs signal.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100591\n");
592
Stefan Krah5de1f822014-05-01 15:53:42 +0200593PyDoc_STRVAR(doc_ctx_compare_total,
594"compare_total($self, x, y, /)\n--\n\n\
595Compare x and y using their abstract representation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100596\n");
597
Stefan Krah5de1f822014-05-01 15:53:42 +0200598PyDoc_STRVAR(doc_ctx_compare_total_mag,
599"compare_total_mag($self, x, y, /)\n--\n\n\
600Compare x and y using their abstract representation, ignoring sign.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100601\n");
602
Stefan Krah5de1f822014-05-01 15:53:42 +0200603PyDoc_STRVAR(doc_ctx_copy_abs,
604"copy_abs($self, x, /)\n--\n\n\
605Return a copy of x with the sign set to 0.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100606\n");
607
Stefan Krah5de1f822014-05-01 15:53:42 +0200608PyDoc_STRVAR(doc_ctx_copy_negate,
609"copy_negate($self, x, /)\n--\n\n\
610Return a copy of x with the sign inverted.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100611\n");
612
Stefan Krah5de1f822014-05-01 15:53:42 +0200613PyDoc_STRVAR(doc_ctx_copy_sign,
614"copy_sign($self, x, y, /)\n--\n\n\
615Copy the sign from y to x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100616\n");
617
Stefan Krah5de1f822014-05-01 15:53:42 +0200618PyDoc_STRVAR(doc_ctx_divide,
619"divide($self, x, y, /)\n--\n\n\
620Return x divided by y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100621\n");
622
Stefan Krah5de1f822014-05-01 15:53:42 +0200623PyDoc_STRVAR(doc_ctx_divide_int,
624"divide_int($self, x, y, /)\n--\n\n\
625Return x divided by y, truncated to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100626\n");
627
Stefan Krah5de1f822014-05-01 15:53:42 +0200628PyDoc_STRVAR(doc_ctx_divmod,
629"divmod($self, x, y, /)\n--\n\n\
630Return quotient and remainder of the division x / y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100631\n");
632
Stefan Krah5de1f822014-05-01 15:53:42 +0200633PyDoc_STRVAR(doc_ctx_exp,
634"exp($self, x, /)\n--\n\n\
635Return e ** x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100636\n");
637
Stefan Krah5de1f822014-05-01 15:53:42 +0200638PyDoc_STRVAR(doc_ctx_fma,
639"fma($self, x, y, z, /)\n--\n\n\
640Return x multiplied by y, plus z.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100641\n");
642
Stefan Krah5de1f822014-05-01 15:53:42 +0200643PyDoc_STRVAR(doc_ctx_is_canonical,
644"is_canonical($self, x, /)\n--\n\n\
645Return True if x is canonical, 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_finite,
649"is_finite($self, x, /)\n--\n\n\
650Return True if x is finite, 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_infinite,
654"is_infinite($self, x, /)\n--\n\n\
655Return True if x is infinite, 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_nan,
659"is_nan($self, x, /)\n--\n\n\
660Return True if x is a qNaN or sNaN, 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_normal,
664"is_normal($self, x, /)\n--\n\n\
665Return True if x is a normal number, 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_qnan,
669"is_qnan($self, x, /)\n--\n\n\
670Return True if x is a quiet NaN, 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_signed,
674"is_signed($self, x, /)\n--\n\n\
675Return True if x is negative, 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_snan,
679"is_snan($self, x, /)\n--\n\n\
680Return True if x is a signaling NaN, 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_subnormal,
684"is_subnormal($self, x, /)\n--\n\n\
685Return True if x is subnormal, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100686\n");
687
Stefan Krah5de1f822014-05-01 15:53:42 +0200688PyDoc_STRVAR(doc_ctx_is_zero,
689"is_zero($self, x, /)\n--\n\n\
690Return True if x is a zero, False otherwise.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100691\n");
692
Robert Smallshire58a7da92020-10-01 18:30:08 +0200693PyDoc_STRVAR(doc_ctx_is_integer,
694"is_integer($self, x, /)\n--\n\n\
695+Return True if x is finite and integral, False otherwise.\n\
696+\n");
697
Stefan Krah5de1f822014-05-01 15:53:42 +0200698PyDoc_STRVAR(doc_ctx_ln,
699"ln($self, x, /)\n--\n\n\
700Return the natural (base e) logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100701\n");
702
Stefan Krah5de1f822014-05-01 15:53:42 +0200703PyDoc_STRVAR(doc_ctx_log10,
704"log10($self, x, /)\n--\n\n\
705Return the base 10 logarithm of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100706\n");
707
Stefan Krah5de1f822014-05-01 15:53:42 +0200708PyDoc_STRVAR(doc_ctx_logb,
709"logb($self, x, /)\n--\n\n\
710Return the exponent of the magnitude of the operand's MSD.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100711\n");
712
Stefan Krah5de1f822014-05-01 15:53:42 +0200713PyDoc_STRVAR(doc_ctx_logical_and,
714"logical_and($self, x, y, /)\n--\n\n\
715Digit-wise and 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_invert,
719"logical_invert($self, x, /)\n--\n\n\
720Invert all digits of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100721\n");
722
Stefan Krah5de1f822014-05-01 15:53:42 +0200723PyDoc_STRVAR(doc_ctx_logical_or,
724"logical_or($self, x, y, /)\n--\n\n\
725Digit-wise or of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100726\n");
727
Stefan Krah5de1f822014-05-01 15:53:42 +0200728PyDoc_STRVAR(doc_ctx_logical_xor,
729"logical_xor($self, x, y, /)\n--\n\n\
730Digit-wise xor of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100731\n");
732
Stefan Krah5de1f822014-05-01 15:53:42 +0200733PyDoc_STRVAR(doc_ctx_max,
734"max($self, x, y, /)\n--\n\n\
735Compare the values numerically and return the maximum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100736\n");
737
Stefan Krah5de1f822014-05-01 15:53:42 +0200738PyDoc_STRVAR(doc_ctx_max_mag,
739"max_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_min,
744"min($self, x, y, /)\n--\n\n\
745Compare the values numerically and return the minimum.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100746\n");
747
Stefan Krah5de1f822014-05-01 15:53:42 +0200748PyDoc_STRVAR(doc_ctx_min_mag,
749"min_mag($self, x, y, /)\n--\n\n\
750Compare the values numerically with their sign ignored.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100751\n");
752
Stefan Krah5de1f822014-05-01 15:53:42 +0200753PyDoc_STRVAR(doc_ctx_minus,
754"minus($self, x, /)\n--\n\n\
755Minus corresponds to the unary prefix minus operator in Python, but applies\n\
756the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100757\n");
758
Stefan Krah5de1f822014-05-01 15:53:42 +0200759PyDoc_STRVAR(doc_ctx_multiply,
760"multiply($self, x, y, /)\n--\n\n\
761Return the product of x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100762\n");
763
Stefan Krah5de1f822014-05-01 15:53:42 +0200764PyDoc_STRVAR(doc_ctx_next_minus,
765"next_minus($self, x, /)\n--\n\n\
766Return the largest representable number smaller than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100767\n");
768
Stefan Krah5de1f822014-05-01 15:53:42 +0200769PyDoc_STRVAR(doc_ctx_next_plus,
770"next_plus($self, x, /)\n--\n\n\
771Return the smallest representable number larger than x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100772\n");
773
Stefan Krah5de1f822014-05-01 15:53:42 +0200774PyDoc_STRVAR(doc_ctx_next_toward,
775"next_toward($self, x, y, /)\n--\n\n\
776Return the number closest to x, in the direction towards y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100777\n");
778
Stefan Krah5de1f822014-05-01 15:53:42 +0200779PyDoc_STRVAR(doc_ctx_normalize,
780"normalize($self, x, /)\n--\n\n\
781Reduce x to its simplest form. Alias for reduce(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100782\n");
783
Stefan Krah5de1f822014-05-01 15:53:42 +0200784PyDoc_STRVAR(doc_ctx_number_class,
785"number_class($self, x, /)\n--\n\n\
786Return an indication of the class of x.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100787\n");
788
Stefan Krah5de1f822014-05-01 15:53:42 +0200789PyDoc_STRVAR(doc_ctx_plus,
790"plus($self, x, /)\n--\n\n\
791Plus corresponds to the unary prefix plus operator in Python, but applies\n\
792the context to the result.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100793\n");
794
Stefan Krah5de1f822014-05-01 15:53:42 +0200795PyDoc_STRVAR(doc_ctx_power,
796"power($self, /, a, b, modulo=None)\n--\n\n\
797Compute a**b. If 'a' is negative, then 'b' must be integral. The result\n\
798will be inexact unless 'a' is integral and the result is finite and can\n\
799be expressed exactly in 'precision' digits. In the Python version the\n\
800result is always correctly rounded, in the C version the result is almost\n\
801always correctly rounded.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100802\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200803If modulo is given, compute (a**b) % modulo. The following restrictions\n\
804hold:\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100805\n\
806 * all three arguments must be integral\n\
Stefan Krah5de1f822014-05-01 15:53:42 +0200807 * 'b' must be nonnegative\n\
808 * at least one of 'a' or 'b' must be nonzero\n\
809 * modulo must be nonzero and less than 10**prec in absolute value\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100810\n\
811\n");
812
Stefan Krah5de1f822014-05-01 15:53:42 +0200813PyDoc_STRVAR(doc_ctx_quantize,
814"quantize($self, x, y, /)\n--\n\n\
815Return a value equal to x (rounded), having the exponent of y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100816\n");
817
Stefan Krah5de1f822014-05-01 15:53:42 +0200818PyDoc_STRVAR(doc_ctx_radix,
819"radix($self, /)\n--\n\n\
820Return 10.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100821\n");
822
Stefan Krah5de1f822014-05-01 15:53:42 +0200823PyDoc_STRVAR(doc_ctx_remainder,
824"remainder($self, x, y, /)\n--\n\n\
825Return the remainder from integer division. The sign of the result,\n\
826if non-zero, is the same as that of the original dividend.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100827\n");
828
Stefan Krah5de1f822014-05-01 15:53:42 +0200829PyDoc_STRVAR(doc_ctx_remainder_near,
830"remainder_near($self, x, y, /)\n--\n\n\
831Return x - y * n, where n is the integer nearest the exact value of x / y\n\
832(if the result is 0 then its sign will be the sign of x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100833\n");
834
Stefan Krah5de1f822014-05-01 15:53:42 +0200835PyDoc_STRVAR(doc_ctx_rotate,
836"rotate($self, x, y, /)\n--\n\n\
837Return a copy of x, rotated by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100838\n");
839
Stefan Krah5de1f822014-05-01 15:53:42 +0200840PyDoc_STRVAR(doc_ctx_same_quantum,
841"same_quantum($self, x, y, /)\n--\n\n\
842Return True if the two operands have the same exponent.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100843\n");
844
Stefan Krah5de1f822014-05-01 15:53:42 +0200845PyDoc_STRVAR(doc_ctx_scaleb,
846"scaleb($self, x, y, /)\n--\n\n\
847Return the first operand after adding the second value to its exp.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100848\n");
849
Stefan Krah5de1f822014-05-01 15:53:42 +0200850PyDoc_STRVAR(doc_ctx_shift,
851"shift($self, x, y, /)\n--\n\n\
852Return a copy of x, shifted by y places.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100853\n");
854
Stefan Krah5de1f822014-05-01 15:53:42 +0200855PyDoc_STRVAR(doc_ctx_sqrt,
856"sqrt($self, x, /)\n--\n\n\
857Square root of a non-negative number to context precision.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100858\n");
859
Stefan Krah5de1f822014-05-01 15:53:42 +0200860PyDoc_STRVAR(doc_ctx_subtract,
861"subtract($self, x, y, /)\n--\n\n\
862Return the difference between x and y.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100863\n");
864
Stefan Krah5de1f822014-05-01 15:53:42 +0200865PyDoc_STRVAR(doc_ctx_to_eng_string,
866"to_eng_string($self, x, /)\n--\n\n\
867Convert a number to a string, using engineering notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100868\n");
869
Stefan Krah5de1f822014-05-01 15:53:42 +0200870PyDoc_STRVAR(doc_ctx_to_integral,
871"to_integral($self, x, /)\n--\n\n\
872Identical to to_integral_value(x).\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100873\n");
874
Stefan Krah5de1f822014-05-01 15:53:42 +0200875PyDoc_STRVAR(doc_ctx_to_integral_exact,
876"to_integral_exact($self, x, /)\n--\n\n\
877Round to an integer. Signal if the result is rounded or inexact.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100878\n");
879
Stefan Krah5de1f822014-05-01 15:53:42 +0200880PyDoc_STRVAR(doc_ctx_to_integral_value,
881"to_integral_value($self, x, /)\n--\n\n\
882Round to an integer.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100883\n");
884
Stefan Krah5de1f822014-05-01 15:53:42 +0200885PyDoc_STRVAR(doc_ctx_to_sci_string,
886"to_sci_string($self, x, /)\n--\n\n\
887Convert a number to a string using scientific notation.\n\
Stefan Krah1919b7e2012-03-21 18:25:23 +0100888\n");
889
890
891#endif /* DOCSTRINGS_H */