@@ -6434,6 +6434,154 @@ _decimal_Context_log10(PyObject *self, PyObject *x)
6434
6434
return ctx_mpd_qlog10 (self , x );
6435
6435
}
6436
6436
6437
+ /*[clinic input]
6438
+ _decimal.Context.minus
6439
+
6440
+ x: object
6441
+ /
6442
+
6443
+ Minus corresponds to unary prefix minus in Python.
6444
+
6445
+ This operation applies the context to the result.
6446
+ [clinic start generated code]*/
6447
+
6448
+ static PyObject *
6449
+ _decimal_Context_minus (PyObject * self , PyObject * x )
6450
+ /*[clinic end generated code: output=8352f35b26cf4493 input=4cbb654187cf6e69]*/
6451
+ {
6452
+ return ctx_mpd_qminus (self , x );
6453
+ }
6454
+
6455
+ /*[clinic input]
6456
+ _decimal.Context.next_minus
6457
+
6458
+ x: object
6459
+ /
6460
+
6461
+ Return the largest representable number smaller than x.
6462
+ [clinic start generated code]*/
6463
+
6464
+ static PyObject *
6465
+ _decimal_Context_next_minus (PyObject * self , PyObject * x )
6466
+ /*[clinic end generated code: output=ff826537eb841b3e input=3e672b2302650914]*/
6467
+ {
6468
+ return ctx_mpd_qnext_minus (self , x );
6469
+ }
6470
+
6471
+ /*[clinic input]
6472
+ _decimal.Context.next_plus
6473
+
6474
+ x: object
6475
+ /
6476
+
6477
+ Return the smallest representable number larger than x.
6478
+ [clinic start generated code]*/
6479
+
6480
+ static PyObject *
6481
+ _decimal_Context_next_plus (PyObject * self , PyObject * x )
6482
+ /*[clinic end generated code: output=2a2ae1e3253efc1b input=dbf8636c5ee0b3f0]*/
6483
+ {
6484
+ return ctx_mpd_qnext_plus (self , x );
6485
+ }
6486
+
6487
+ /*[clinic input]
6488
+ _decimal.Context.normalize
6489
+
6490
+ x: object
6491
+ /
6492
+
6493
+ Reduce x to its simplest form. Alias for reduce(x).
6494
+ [clinic start generated code]*/
6495
+
6496
+ static PyObject *
6497
+ _decimal_Context_normalize (PyObject * self , PyObject * x )
6498
+ /*[clinic end generated code: output=aa671c1aec4547cc input=f0b0fa9384f5da94]*/
6499
+ {
6500
+ return ctx_mpd_qreduce (self , x );
6501
+ }
6502
+
6503
+ /*[clinic input]
6504
+ _decimal.Context.plus
6505
+
6506
+ x: object
6507
+ /
6508
+
6509
+ Plus corresponds to the unary prefix plus operator in Python.
6510
+
6511
+ This operation applies the context to the result.
6512
+ [clinic start generated code]*/
6513
+
6514
+ static PyObject *
6515
+ _decimal_Context_plus (PyObject * self , PyObject * x )
6516
+ /*[clinic end generated code: output=b98165faa988e531 input=a3f9833ca90ec079]*/
6517
+ {
6518
+ return ctx_mpd_qplus (self , x );
6519
+ }
6520
+
6521
+ /*[clinic input]
6522
+ _decimal.Context.to_integral_value
6523
+
6524
+ x: object
6525
+ /
6526
+
6527
+ Round to an integer.
6528
+ [clinic start generated code]*/
6529
+
6530
+ static PyObject *
6531
+ _decimal_Context_to_integral_value (PyObject * self , PyObject * x )
6532
+ /*[clinic end generated code: output=41383a5b39dcd0d0 input=c6dc6ea5ea1e89c5]*/
6533
+ {
6534
+ return ctx_mpd_qround_to_int (self , x );
6535
+ }
6536
+
6537
+ /*[clinic input]
6538
+ _decimal.Context.to_integral_exact
6539
+
6540
+ x: object
6541
+ /
6542
+
6543
+ Round to an integer. Signal if the result is rounded or inexact.
6544
+ [clinic start generated code]*/
6545
+
6546
+ static PyObject *
6547
+ _decimal_Context_to_integral_exact (PyObject * self , PyObject * x )
6548
+ /*[clinic end generated code: output=2480c73e9fb130a1 input=7fbed586d5991bc2]*/
6549
+ {
6550
+ return ctx_mpd_qround_to_intx (self , x );
6551
+ }
6552
+
6553
+ /*[clinic input]
6554
+ _decimal.Context.to_integral
6555
+
6556
+ x: object
6557
+ /
6558
+
6559
+ Identical to to_integral_value(x).
6560
+ [clinic start generated code]*/
6561
+
6562
+ static PyObject *
6563
+ _decimal_Context_to_integral (PyObject * self , PyObject * x )
6564
+ /*[clinic end generated code: output=6c5808344ce33746 input=fb37223022ffc973]*/
6565
+ {
6566
+ return ctx_mpd_qround_to_int (self , x );
6567
+ }
6568
+
6569
+ /*[clinic input]
6570
+ _decimal.Context.sqrt
6571
+
6572
+ x: object
6573
+ /
6574
+
6575
+ Square root of a non-negative number to context precision.
6576
+ [clinic start generated code]*/
6577
+
6578
+ static PyObject *
6579
+ _decimal_Context_sqrt (PyObject * self , PyObject * x )
6580
+ /*[clinic end generated code: output=7f5cab169abf8a1a input=37375b6ff339cc93]*/
6581
+ {
6582
+ return ctx_mpd_qsqrt (self , x );
6583
+ }
6584
+
6437
6585
/* Binary arithmetic functions */
6438
6586
DecCtx_BinaryFunc (mpd_qadd )
6439
6587
DecCtx_BinaryFunc (mpd_qcompare )
@@ -6801,15 +6949,15 @@ static PyMethodDef context_methods [] =
6801
6949
_DECIMAL_CONTEXT_EXP_METHODDEF
6802
6950
_DECIMAL_CONTEXT_LN_METHODDEF
6803
6951
_DECIMAL_CONTEXT_LOG10_METHODDEF
6804
- { "minus" , ctx_mpd_qminus , METH_O , doc_ctx_minus },
6805
- { "next_minus" , ctx_mpd_qnext_minus , METH_O , doc_ctx_next_minus },
6806
- { "next_plus" , ctx_mpd_qnext_plus , METH_O , doc_ctx_next_plus },
6807
- { "normalize" , ctx_mpd_qreduce , METH_O , doc_ctx_normalize },
6808
- { "plus" , ctx_mpd_qplus , METH_O , doc_ctx_plus },
6809
- { "to_integral" , ctx_mpd_qround_to_int , METH_O , doc_ctx_to_integral },
6810
- { "to_integral_exact" , ctx_mpd_qround_to_intx , METH_O , doc_ctx_to_integral_exact },
6811
- { "to_integral_value" , ctx_mpd_qround_to_int , METH_O , doc_ctx_to_integral_value },
6812
- { "sqrt" , ctx_mpd_qsqrt , METH_O , doc_ctx_sqrt },
6952
+ _DECIMAL_CONTEXT_MINUS_METHODDEF
6953
+ _DECIMAL_CONTEXT_NEXT_MINUS_METHODDEF
6954
+ _DECIMAL_CONTEXT_NEXT_PLUS_METHODDEF
6955
+ _DECIMAL_CONTEXT_NORMALIZE_METHODDEF
6956
+ _DECIMAL_CONTEXT_PLUS_METHODDEF
6957
+ _DECIMAL_CONTEXT_TO_INTEGRAL_METHODDEF
6958
+ _DECIMAL_CONTEXT_TO_INTEGRAL_EXACT_METHODDEF
6959
+ _DECIMAL_CONTEXT_TO_INTEGRAL_VALUE_METHODDEF
6960
+ _DECIMAL_CONTEXT_SQRT_METHODDEF
6813
6961
6814
6962
/* Binary arithmetic functions */
6815
6963
{ "add" , ctx_mpd_qadd , METH_VARARGS , doc_ctx_add },
0 commit comments