@@ -6419,6 +6419,154 @@ _decimal_Context_log10(PyObject *self, PyObject *x)
64196419 return ctx_mpd_qlog10 (self , x );
64206420}
64216421
6422+ /*[clinic input]
6423+ _decimal.Context.minus
6424+
6425+ x: object
6426+ /
6427+
6428+ Minus corresponds to unary prefix minus in Python.
6429+
6430+ This operation applies the context to the result.
6431+ [clinic start generated code]*/
6432+
6433+ static PyObject *
6434+ _decimal_Context_minus (PyObject * self , PyObject * x )
6435+ /*[clinic end generated code: output=8352f35b26cf4493 input=4cbb654187cf6e69]*/
6436+ {
6437+ return ctx_mpd_qminus (self , x );
6438+ }
6439+
6440+ /*[clinic input]
6441+ _decimal.Context.next_minus
6442+
6443+ x: object
6444+ /
6445+
6446+ Return the largest representable number smaller than x.
6447+ [clinic start generated code]*/
6448+
6449+ static PyObject *
6450+ _decimal_Context_next_minus (PyObject * self , PyObject * x )
6451+ /*[clinic end generated code: output=ff826537eb841b3e input=3e672b2302650914]*/
6452+ {
6453+ return ctx_mpd_qnext_minus (self , x );
6454+ }
6455+
6456+ /*[clinic input]
6457+ _decimal.Context.next_plus
6458+
6459+ x: object
6460+ /
6461+
6462+ Return the smallest representable number larger than x.
6463+ [clinic start generated code]*/
6464+
6465+ static PyObject *
6466+ _decimal_Context_next_plus (PyObject * self , PyObject * x )
6467+ /*[clinic end generated code: output=2a2ae1e3253efc1b input=dbf8636c5ee0b3f0]*/
6468+ {
6469+ return ctx_mpd_qnext_plus (self , x );
6470+ }
6471+
6472+ /*[clinic input]
6473+ _decimal.Context.normalize
6474+
6475+ x: object
6476+ /
6477+
6478+ Reduce x to its simplest form. Alias for reduce(x).
6479+ [clinic start generated code]*/
6480+
6481+ static PyObject *
6482+ _decimal_Context_normalize (PyObject * self , PyObject * x )
6483+ /*[clinic end generated code: output=aa671c1aec4547cc input=f0b0fa9384f5da94]*/
6484+ {
6485+ return ctx_mpd_qreduce (self , x );
6486+ }
6487+
6488+ /*[clinic input]
6489+ _decimal.Context.plus
6490+
6491+ x: object
6492+ /
6493+
6494+ Plus corresponds to the unary prefix plus operator in Python.
6495+
6496+ This operation applies the context to the result.
6497+ [clinic start generated code]*/
6498+
6499+ static PyObject *
6500+ _decimal_Context_plus (PyObject * self , PyObject * x )
6501+ /*[clinic end generated code: output=b98165faa988e531 input=a3f9833ca90ec079]*/
6502+ {
6503+ return ctx_mpd_qplus (self , x );
6504+ }
6505+
6506+ /*[clinic input]
6507+ _decimal.Context.to_integral_value
6508+
6509+ x: object
6510+ /
6511+
6512+ Round to an integer.
6513+ [clinic start generated code]*/
6514+
6515+ static PyObject *
6516+ _decimal_Context_to_integral_value (PyObject * self , PyObject * x )
6517+ /*[clinic end generated code: output=41383a5b39dcd0d0 input=c6dc6ea5ea1e89c5]*/
6518+ {
6519+ return ctx_mpd_qround_to_int (self , x );
6520+ }
6521+
6522+ /*[clinic input]
6523+ _decimal.Context.to_integral_exact
6524+
6525+ x: object
6526+ /
6527+
6528+ Round to an integer. Signal if the result is rounded or inexact.
6529+ [clinic start generated code]*/
6530+
6531+ static PyObject *
6532+ _decimal_Context_to_integral_exact (PyObject * self , PyObject * x )
6533+ /*[clinic end generated code: output=2480c73e9fb130a1 input=7fbed586d5991bc2]*/
6534+ {
6535+ return ctx_mpd_qround_to_intx (self , x );
6536+ }
6537+
6538+ /*[clinic input]
6539+ _decimal.Context.to_integral
6540+
6541+ x: object
6542+ /
6543+
6544+ Identical to to_integral_value(x).
6545+ [clinic start generated code]*/
6546+
6547+ static PyObject *
6548+ _decimal_Context_to_integral (PyObject * self , PyObject * x )
6549+ /*[clinic end generated code: output=6c5808344ce33746 input=fb37223022ffc973]*/
6550+ {
6551+ return ctx_mpd_qround_to_int (self , x );
6552+ }
6553+
6554+ /*[clinic input]
6555+ _decimal.Context.sqrt
6556+
6557+ x: object
6558+ /
6559+
6560+ Square root of a non-negative number to context precision.
6561+ [clinic start generated code]*/
6562+
6563+ static PyObject *
6564+ _decimal_Context_sqrt (PyObject * self , PyObject * x )
6565+ /*[clinic end generated code: output=7f5cab169abf8a1a input=37375b6ff339cc93]*/
6566+ {
6567+ return ctx_mpd_qsqrt (self , x );
6568+ }
6569+
64226570/* Binary arithmetic functions */
64236571DecCtx_BinaryFunc (mpd_qadd )
64246572DecCtx_BinaryFunc (mpd_qcompare )
@@ -6786,15 +6934,15 @@ static PyMethodDef context_methods [] =
67866934 _DECIMAL_CONTEXT_EXP_METHODDEF
67876935 _DECIMAL_CONTEXT_LN_METHODDEF
67886936 _DECIMAL_CONTEXT_LOG10_METHODDEF
6789- { "minus" , ctx_mpd_qminus , METH_O , doc_ctx_minus },
6790- { "next_minus" , ctx_mpd_qnext_minus , METH_O , doc_ctx_next_minus },
6791- { "next_plus" , ctx_mpd_qnext_plus , METH_O , doc_ctx_next_plus },
6792- { "normalize" , ctx_mpd_qreduce , METH_O , doc_ctx_normalize },
6793- { "plus" , ctx_mpd_qplus , METH_O , doc_ctx_plus },
6794- { "to_integral" , ctx_mpd_qround_to_int , METH_O , doc_ctx_to_integral },
6795- { "to_integral_exact" , ctx_mpd_qround_to_intx , METH_O , doc_ctx_to_integral_exact },
6796- { "to_integral_value" , ctx_mpd_qround_to_int , METH_O , doc_ctx_to_integral_value },
6797- { "sqrt" , ctx_mpd_qsqrt , METH_O , doc_ctx_sqrt },
6937+ _DECIMAL_CONTEXT_MINUS_METHODDEF
6938+ _DECIMAL_CONTEXT_NEXT_MINUS_METHODDEF
6939+ _DECIMAL_CONTEXT_NEXT_PLUS_METHODDEF
6940+ _DECIMAL_CONTEXT_NORMALIZE_METHODDEF
6941+ _DECIMAL_CONTEXT_PLUS_METHODDEF
6942+ _DECIMAL_CONTEXT_TO_INTEGRAL_METHODDEF
6943+ _DECIMAL_CONTEXT_TO_INTEGRAL_EXACT_METHODDEF
6944+ _DECIMAL_CONTEXT_TO_INTEGRAL_VALUE_METHODDEF
6945+ _DECIMAL_CONTEXT_SQRT_METHODDEF
67986946
67996947 /* Binary arithmetic functions */
68006948 { "add" , ctx_mpd_qadd , METH_VARARGS , doc_ctx_add },
0 commit comments