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

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

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

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