|
63 | 63 | /*[clinic input] |
64 | 64 | module _decimal |
65 | 65 | class _decimal.Decimal "PyObject *" "&dec_spec" |
| 66 | +class _decimal.Context "PyObject *" "&ctx_spec" |
66 | 67 | [clinic start generated code]*/ |
67 | | -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e0e1f68f1f413f5f]*/ |
| 68 | +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8c3aa7cfde934d7b]*/ |
68 | 69 |
|
69 | 70 | struct PyDecContextObject; |
70 | 71 | struct DecCondMap; |
@@ -6362,6 +6363,70 @@ DecCtx_UnaryFunc(mpd_qround_to_int) |
6362 | 6363 | DecCtx_UnaryFunc(mpd_qround_to_intx) |
6363 | 6364 | DecCtx_UnaryFunc(mpd_qsqrt) |
6364 | 6365 |
|
| 6366 | +/*[clinic input] |
| 6367 | +_decimal.Context.abs |
| 6368 | +
|
| 6369 | + x: object |
| 6370 | + / |
| 6371 | +
|
| 6372 | +Return the absolute value of x. |
| 6373 | +[clinic start generated code]*/ |
| 6374 | + |
| 6375 | +static PyObject * |
| 6376 | +_decimal_Context_abs(PyObject *self, PyObject *x) |
| 6377 | +/*[clinic end generated code: output=91c87f912542b183 input=2b69fea7e24c710f]*/ |
| 6378 | +{ |
| 6379 | + return ctx_mpd_qabs(self, x); |
| 6380 | +} |
| 6381 | + |
| 6382 | +/*[clinic input] |
| 6383 | +_decimal.Context.exp |
| 6384 | +
|
| 6385 | + x: object |
| 6386 | + / |
| 6387 | +
|
| 6388 | +Return e ** x. |
| 6389 | +[clinic start generated code]*/ |
| 6390 | + |
| 6391 | +static PyObject * |
| 6392 | +_decimal_Context_exp(PyObject *self, PyObject *x) |
| 6393 | +/*[clinic end generated code: output=f8d14995cc8c76e7 input=37f44653b0f7397e]*/ |
| 6394 | +{ |
| 6395 | + return ctx_mpd_qexp(self, x); |
| 6396 | +} |
| 6397 | + |
| 6398 | +/*[clinic input] |
| 6399 | +_decimal.Context.ln |
| 6400 | +
|
| 6401 | + x: object |
| 6402 | + / |
| 6403 | +
|
| 6404 | +Return the natural (base e) logarithm of x. |
| 6405 | +[clinic start generated code]*/ |
| 6406 | + |
| 6407 | +static PyObject * |
| 6408 | +_decimal_Context_ln(PyObject *self, PyObject *x) |
| 6409 | +/*[clinic end generated code: output=9caae5de322ac831 input=e76c7d7b8912accb]*/ |
| 6410 | +{ |
| 6411 | + return ctx_mpd_qln(self, x); |
| 6412 | +} |
| 6413 | + |
| 6414 | +/*[clinic input] |
| 6415 | +_decimal.Context.log10 |
| 6416 | +
|
| 6417 | + x: object |
| 6418 | + / |
| 6419 | +
|
| 6420 | +Return the base 10 logarithm of x. |
| 6421 | +[clinic start generated code]*/ |
| 6422 | + |
| 6423 | +static PyObject * |
| 6424 | +_decimal_Context_log10(PyObject *self, PyObject *x) |
| 6425 | +/*[clinic end generated code: output=480e54cfd384b3ef input=c0199e3f92fc3075]*/ |
| 6426 | +{ |
| 6427 | + return ctx_mpd_qlog10(self, x); |
| 6428 | +} |
| 6429 | + |
6365 | 6430 | /* Binary arithmetic functions */ |
6366 | 6431 | DecCtx_BinaryFunc(mpd_qadd) |
6367 | 6432 | DecCtx_BinaryFunc(mpd_qcompare) |
@@ -6725,10 +6790,10 @@ ctx_mpd_same_quantum(PyObject *context, PyObject *args) |
6725 | 6790 | static PyMethodDef context_methods [] = |
6726 | 6791 | { |
6727 | 6792 | /* Unary arithmetic functions */ |
6728 | | - { "abs", ctx_mpd_qabs, METH_O, doc_ctx_abs }, |
6729 | | - { "exp", ctx_mpd_qexp, METH_O, doc_ctx_exp }, |
6730 | | - { "ln", ctx_mpd_qln, METH_O, doc_ctx_ln }, |
6731 | | - { "log10", ctx_mpd_qlog10, METH_O, doc_ctx_log10 }, |
| 6793 | + _DECIMAL_CONTEXT_ABS_METHODDEF |
| 6794 | + _DECIMAL_CONTEXT_EXP_METHODDEF |
| 6795 | + _DECIMAL_CONTEXT_LN_METHODDEF |
| 6796 | + _DECIMAL_CONTEXT_LOG10_METHODDEF |
6732 | 6797 | { "minus", ctx_mpd_qminus, METH_O, doc_ctx_minus }, |
6733 | 6798 | { "next_minus", ctx_mpd_qnext_minus, METH_O, doc_ctx_next_minus }, |
6734 | 6799 | { "next_plus", ctx_mpd_qnext_plus, METH_O, doc_ctx_next_plus }, |
|
0 commit comments