File: decimal.html

package info (click to toggle)
mpdecimal 2.5.1-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 10,336 kB
  • sloc: ansic: 17,720; javascript: 8,438; cpp: 6,299; sh: 3,464; makefile: 574; lisp: 502; python: 371; asm: 18
file content (1441 lines) | stat: -rw-r--r-- 123,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta content="index,follow" name="robots" />
<meta content="libmpdec++ documentation" name="description" />

    <title>Decimal class &#8212; mpdecimal 2.5.1 documentation</title>
    <link rel="stylesheet" href="_static/mpdecimal-doc.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/language_data.js"></script>
    
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="Context" href="context.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="context.html" title="Context"
             accesskey="P">previous</a></li>
    <li><a href="http://www.bytereef.org/mpdecimal/index.html">project home</a></li>
 
      </ul>
    </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Decimal class</a><ul>
<li><a class="reference internal" href="#exact-constructors">Exact constructors</a></li>
<li><a class="reference internal" href="#inexact-constructors">Inexact constructors</a></li>
<li><a class="reference internal" href="#accessors">Accessors</a></li>
<li><a class="reference internal" href="#exact-assignment-operators">Exact assignment operators</a></li>
<li><a class="reference internal" href="#inexact-assignment-operators">Inexact assignment operators</a></li>
<li><a class="reference internal" href="#exact-comparison-operators">Exact comparison operators</a></li>
<li><a class="reference internal" href="#exact-reverse-comparison-operators">Exact reverse comparison operators</a></li>
<li><a class="reference internal" href="#unary-arithmetic-operators">Unary arithmetic operators</a></li>
<li><a class="reference internal" href="#binary-arithmetic-operators">Binary arithmetic operators</a></li>
<li><a class="reference internal" href="#reverse-binary-arithmetic-operators">Reverse binary arithmetic operators</a></li>
<li><a class="reference internal" href="#predicates">Predicates</a></li>
<li><a class="reference internal" href="#predicates-with-an-optional-context-argument">Predicates with an optional context argument</a></li>
<li><a class="reference internal" href="#unary-functions-no-context-argument">Unary functions, no context argument</a></li>
<li><a class="reference internal" href="#unary-functions-optional-context-argument">Unary functions, optional context argument</a></li>
<li><a class="reference internal" href="#binary-functions-no-context-argument">Binary functions, no context argument</a></li>
<li><a class="reference internal" href="#binary-functions-optional-context-argument">Binary functions, optional context argument</a></li>
<li><a class="reference internal" href="#binary-functions-two-return-values">Binary functions, two return values</a></li>
<li><a class="reference internal" href="#ternary-functions">Ternary functions</a></li>
<li><a class="reference internal" href="#irregular-functions">Irregular functions</a></li>
<li><a class="reference internal" href="#exact-integer-conversion">Exact integer conversion</a></li>
<li><a class="reference internal" href="#exact-triple-conversion">Exact triple conversion</a></li>
<li><a class="reference internal" href="#exact-string-conversion">Exact string conversion</a></li>
<li><a class="reference internal" href="#inexact-string-conversion">Inexact string conversion</a></li>
<li><a class="reference internal" href="#streams">Streams</a></li>
<li><a class="reference internal" href="#required-by-the-specification">Required by the specification</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="context.html"
                        title="previous chapter">Context</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="decimal-class">
<h1>Decimal class</h1>
<div class="section" id="exact-constructors">
<h2>Exact constructors</h2>
<dl class="class">
<dt id="_CPPv4N7decimal7DecimalE">
<span id="_CPPv3N7decimal7DecimalE"></span><span id="_CPPv2N7decimal7DecimalE"></span><span id="decimal::Decimal"></span><em class="property">class </em><code class="descname">Decimal</code><br /></dt>
<dd><dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalEv">
<span id="_CPPv3N7decimal7Decimal7DecimalEv"></span><span id="_CPPv2N7decimal7Decimal7DecimalEv"></span><span id="decimal::Decimal::Decimal"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt>
<dd><p>Default constructor. The value is initialized to a signaling <cite>NaN</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalERK7Decimal">
<span id="_CPPv3N7decimal7Decimal7DecimalERK7Decimal"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK7Decimal"></span><span id="decimal::Decimal::Decimal__DecimalCR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7Decimal7DecimalEv" title="decimal::Decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact construction by copying the argument.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalERRK7Decimal">
<span id="_CPPv3N7decimal7Decimal7DecimalERRK7Decimal"></span><span id="_CPPv2N7decimal7Decimal7DecimalERRK7Decimal"></span><span id="decimal::Decimal::Decimal__DecimalCRR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7Decimal7DecimalEv" title="decimal::Decimal::Decimal">Decimal</a> &amp;&amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact construction by moving the argument. The argument is reset to a
signaling <cite>NaN</cite>, so it is still in a valid state.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalERK1T">
<span id="_CPPv3N7decimal7Decimal7DecimalERK1T"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK1T"></span><span id="decimal::Decimal::Decimal__TCR"></span><code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact integer conversions.  <cite>T</cite> is one of:</p>
<blockquote>
<div><table border="1" class="docutils align-default">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><cite>int8_t</cite></td>
<td><cite>uint8_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int16_t</cite></td>
<td><cite>uint16_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>int32_t</cite></td>
<td><cite>uint32_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int64_t</cite></td>
<td><cite>uint64_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>signed char</cite></td>
<td><cite>unsigned char</cite></td>
</tr>
<tr class="row-even"><td><cite>short</cite></td>
<td><cite>unsigned short</cite></td>
</tr>
<tr class="row-odd"><td><cite>int</cite></td>
<td><cite>unsigned int</cite></td>
</tr>
<tr class="row-even"><td><cite>long</cite></td>
<td><cite>unsigned long</cite></td>
</tr>
<tr class="row-odd"><td><cite>long long</cite></td>
<td><cite>unsigned long long</cite></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>Since construction is always exact, it is safe to allow implicit conversions.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalEPCKc">
<span id="_CPPv3N7decimal7Decimal7DecimalEPCKc"></span><span id="_CPPv2N7decimal7Decimal7DecimalEPCKc"></span><span id="decimal::Decimal::Decimal__cCPC"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact conversion from a <cite>C</cite> string.  If an internal limit is exceeded
(e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set
and the result is <cite>NaN</cite>.</p>
<p>Raises <cite>ValueError</cite> if the argument is <cite>NULL</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalERKNSt6stringE">
<span id="_CPPv3N7decimal7Decimal7DecimalERKNSt6stringE"></span><span id="_CPPv2N7decimal7Decimal7DecimalERKNSt6stringE"></span><span id="decimal::Decimal::Decimal__ssCR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> std::string &amp;<em>s</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact conversion from a <cite>std::string</cite>.  If an internal limit is exceeded
(e.g. the exponent exceeds <cite>MAX_EMAX</cite>), <cite>InvalidOperation</cite> is set
and the result is <cite>NaN</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t">
<span id="_CPPv3N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t"></span><span id="_CPPv2N7decimal7Decimal7DecimalERK20mpd_uint128_triple_t"></span><span id="decimal::Decimal::Decimal__mpd_uint128_triple_tCR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> mpd_uint128_triple_t &amp;<em>triple</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Exact conversion from an <cite>mpd_uint128_triple_t</cite>.  The triple can represent
Decimals with a coefficient up to 38 decimal digits. Refer to the <cite>libmpdec</cite>
documentation for details (See: <cite>mpd_from_uint128_triple</cite>).</p>
<p>Raises <cite>InvalidOperation</cite> for invalid input and <cite>MemoryError</cite> for allocation
failures.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="inexact-constructors">
<h2>Inexact constructors</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimal7DecimalERK7DecimalR7Context">
<span id="_CPPv3N7decimal7DecimalERK7DecimalR7Context"></span><span id="_CPPv2N7decimal7DecimalERK7DecimalR7Context"></span><span id="decimal::Decimal__DecimalCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Inexact construction according to the context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7DecimalERK1TR7Context">
<span id="_CPPv3N7decimal7DecimalERK1TR7Context"></span><span id="_CPPv2N7decimal7DecimalERK1TR7Context"></span><span id="decimal::Decimal__TCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Inexact integer conversions according to the context.  <cite>T</cite> is one of:</p>
<blockquote>
<div><table border="1" class="docutils align-default">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><cite>int8_t</cite></td>
<td><cite>uint8_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int16_t</cite></td>
<td><cite>uint16_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>int32_t</cite></td>
<td><cite>uint32_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int64_t</cite></td>
<td><cite>uint64_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>signed char</cite></td>
<td><cite>unsigned char</cite></td>
</tr>
<tr class="row-even"><td><cite>short</cite></td>
<td><cite>unsigned short</cite></td>
</tr>
<tr class="row-odd"><td><cite>int</cite></td>
<td><cite>unsigned int</cite></td>
</tr>
<tr class="row-even"><td><cite>long</cite></td>
<td><cite>unsigned long</cite></td>
</tr>
<tr class="row-odd"><td><cite>long long</cite></td>
<td><cite>unsigned long long</cite></td>
</tr>
</tbody>
</table>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7DecimalEPCKcR7Context">
<span id="_CPPv3N7decimal7DecimalEPCKcR7Context"></span><span id="_CPPv2N7decimal7DecimalEPCKcR7Context"></span><span id="decimal::Decimal__cCPC.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Inexact conversion from a <cite>C</cite> string according to the context.  If an
internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>),
<cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p>
<p>Raises <cite>ValueError</cite> if the argument is <cite>NULL</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal7DecimalERKNSt6stringER7Context">
<span id="_CPPv3N7decimal7DecimalERKNSt6stringER7Context"></span><span id="_CPPv2N7decimal7DecimalERKNSt6stringER7Context"></span><span id="decimal::Decimal__ssCR.ContextR"></span><em class="property">explicit</em> <code class="descname">Decimal</code><span class="sig-paren">(</span><em class="property">const</em> std::string &amp;<em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Inexact conversion from a <cite>std::string</cite> according to the context.  If an
internal limit is exceeded (e.g. the exponent exceeds <cite>MAX_EMAX</cite>),
<cite>InvalidOperation</cite> is set and the result is <cite>NaN</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="accessors">
<h2>Accessors</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimal3getEv">
<span id="_CPPv3N7decimal3getEv"></span><span id="_CPPv2N7decimal3getEv"></span><span id="decimal::get"></span>mpd_t *<code class="descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt>
<dd><p>Return a pointer to the private <cite>mpd_t</cite>.  This should only be used for passing
a Decimal’s internal value to <cite>libmpdec</cite> functions, where the Decimal is in
the output position.</p>
<p>This is an advanced function that is not necessary for normal use.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8getconstEv">
<span id="_CPPv3NK7decimal8getconstEv"></span><span id="_CPPv2NK7decimal8getconstEv"></span><span id="decimal::getconstC"></span><em class="property">const</em> mpd_t *<code class="descname">getconst</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a const pointer to the private <cite>mpd_t</cite>.  This should only be used for
passing a Decimal’s internal value to <cite>libmpdec</cite> functions, where the Decimal
is in the input position.</p>
<p>This is an advanced function that is not necessary for normal use.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4signEv">
<span id="_CPPv3NK7decimal4signEv"></span><span id="_CPPv2NK7decimal4signEv"></span><span id="decimal::signC"></span>int <code class="descname">sign</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the arithmetic sign of the Decimal: <cite>1</cite> for positive values, <cite>-1</cite>
for negative values.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5coeffEv">
<span id="_CPPv3NK7decimal5coeffEv"></span><span id="_CPPv2NK7decimal5coeffEv"></span><span id="decimal::coeffC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">coeff</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the coefficient of the Decimal.  If the Decimal is a special value,
raise <cite>ValueError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8exponentEv">
<span id="_CPPv3NK7decimal8exponentEv"></span><span id="_CPPv2NK7decimal8exponentEv"></span><span id="decimal::exponentC"></span>int64_t <code class="descname">exponent</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the exponent of the Decimal.  If the Decimal is a special value,
raise <cite>ValueError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7payloadEv">
<span id="_CPPv3NK7decimal7payloadEv"></span><span id="_CPPv2NK7decimal7payloadEv"></span><span id="decimal::payloadC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">payload</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the <cite>NaN</cite> payload of the Decimal.  The default value for <cite>NaNs</cite>
without a payload is <cite>0</cite>.</p>
<p>If the Decimal is not a <cite>NaN</cite>, raise <cite>ValueError</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-assignment-operators">
<h2>Exact assignment operators</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimalaSERK7Decimal">
<span id="_CPPv3N7decimalaSERK7Decimal"></span><span id="_CPPv2N7decimalaSERK7Decimal"></span><span id="decimal::assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Make an exact copy of the argument. This function can raise <cite>MallocError</cite>
if <cite>self</cite> is an arbitrary precision Decimal with a very large coefficient.
In practice this does not occur with regular context precisions from
9 to 38 digits.</p>
<p>Copying has a strong exception guarantee, so the lvalue is unchanged
in case of <cite>MallocError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalaSERR7Decimal">
<span id="_CPPv3N7decimalaSERR7Decimal"></span><span id="_CPPv2N7decimalaSERR7Decimal"></span><span id="decimal::assign-operator__DecimalRR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator=</code><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;&amp;<em>other</em><span class="sig-paren">)</span> <em class="property">noexcept</em><br /></dt>
<dd><p>Move the argument. The argument is reset to <cite>sNaN</cite> and is still in
a valid state.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="inexact-assignment-operators">
<h2>Inexact assignment operators</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimalpLERK7Decimal">
<span id="_CPPv3N7decimalpLERK7Decimal"></span><span id="_CPPv2N7decimalpLERK7Decimal"></span><span id="decimal::add-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator+=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>In-place add.  Uses the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalmIERK7Decimal">
<span id="_CPPv3N7decimalmIERK7Decimal"></span><span id="_CPPv2N7decimalmIERK7Decimal"></span><span id="decimal::sub-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator-=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>In-place subtract.  Uses the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalmLERK7Decimal">
<span id="_CPPv3N7decimalmLERK7Decimal"></span><span id="_CPPv2N7decimalmLERK7Decimal"></span><span id="decimal::mul-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator*=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>In-place multiply.  Uses the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimaldVERK7Decimal">
<span id="_CPPv3N7decimaldVERK7Decimal"></span><span id="_CPPv2N7decimaldVERK7Decimal"></span><span id="decimal::div-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator/=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>In-place divide.  Uses the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalrMERK7Decimal">
<span id="_CPPv3N7decimalrMERK7Decimal"></span><span id="_CPPv2N7decimalrMERK7Decimal"></span><span id="decimal::mod-assign-operator__DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<code class="descname">operator%=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span><br /></dt>
<dd><p>In-place remainder.  Uses the thread local context.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-comparison-operators">
<h2>Exact comparison operators</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimaleqERK7Decimal">
<span id="_CPPv3NK7decimaleqERK7Decimal"></span><span id="_CPPv2NK7decimaleqERK7Decimal"></span><span id="decimal::eq-operator__DecimalCRC"></span>bool <code class="descname">operator==</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if the values are exactly equal. Infinities compare equal
if the signs are equal. Quiet <cite>NaNs</cite> are not equal to anything else
(including quiet <cite>NaNs</cite>).</p>
<p>Signaling <cite>NaNs</cite> set <cite>InvalidOperation</cite>, using the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalneERK7Decimal">
<span id="_CPPv3NK7decimalneERK7Decimal"></span><span id="_CPPv2NK7decimalneERK7Decimal"></span><span id="decimal::neq-operator__DecimalCRC"></span>bool <code class="descname">operator!=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if the values are not equal. The above rules apply
(adapted for <cite>!=</cite>).</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalltERK7Decimal">
<span id="_CPPv3NK7decimalltERK7Decimal"></span><span id="_CPPv2NK7decimalltERK7Decimal"></span><span id="decimal::lt-operator__DecimalCRC"></span>bool <code class="descname">operator&lt;</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if <cite>self &lt; other</cite>.  In the case of ordering comparisons quiet
<cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalleERK7Decimal">
<span id="_CPPv3NK7decimalleERK7Decimal"></span><span id="_CPPv2NK7decimalleERK7Decimal"></span><span id="decimal::lte-operator__DecimalCRC"></span>bool <code class="descname">operator&lt;=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if <cite>self &lt;= other</cite>.  In the case of ordering comparisons quiet
<cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalgeERK7Decimal">
<span id="_CPPv3NK7decimalgeERK7Decimal"></span><span id="_CPPv2NK7decimalgeERK7Decimal"></span><span id="decimal::gte-operator__DecimalCRC"></span>bool <code class="descname">operator&gt;=</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if <cite>self &gt;= other</cite>.  In the case of ordering comparisons quiet
<cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalgtERK7Decimal">
<span id="_CPPv3NK7decimalgtERK7Decimal"></span><span id="_CPPv2NK7decimalgtERK7Decimal"></span><span id="decimal::gt-operator__DecimalCRC"></span>bool <code class="descname">operator&gt;</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine if <cite>self &gt; other</cite>.  In the case of ordering comparisons quiet
<cite>NaNs</cite> also set <cite>InvalidOperation</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-reverse-comparison-operators">
<h2>Exact reverse comparison operators</h2>
<blockquote>
<div><p>Reverse comparison operators. <cite>T</cite> is one of:</p>
<blockquote>
<div><table border="1" class="docutils align-default">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><cite>int8_t</cite></td>
<td><cite>uint8_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int16_t</cite></td>
<td><cite>uint16_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>int32_t</cite></td>
<td><cite>uint32_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int64_t</cite></td>
<td><cite>uint64_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>signed char</cite></td>
<td><cite>unsigned char</cite></td>
</tr>
<tr class="row-even"><td><cite>short</cite></td>
<td><cite>unsigned short</cite></td>
</tr>
<tr class="row-odd"><td><cite>int</cite></td>
<td><cite>unsigned int</cite></td>
</tr>
<tr class="row-even"><td><cite>long</cite></td>
<td><cite>unsigned long</cite></td>
</tr>
<tr class="row-odd"><td><cite>long long</cite></td>
<td><cite>unsigned long long</cite></td>
</tr>
</tbody>
</table>
</div></blockquote>
<dl class="function">
<dt id="_CPPv4N7decimaleqERK1TRK7Decimal">
<span id="_CPPv3N7decimaleqERK1TRK7Decimal"></span><span id="_CPPv2N7decimaleqERK1TRK7Decimal"></span><span id="decimal::eq-operator__TCR.DecimalCR"></span>bool <code class="descname">operator==</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalneERK1TRK7Decimal">
<span id="_CPPv3N7decimalneERK1TRK7Decimal"></span><span id="_CPPv2N7decimalneERK1TRK7Decimal"></span><span id="decimal::neq-operator__TCR.DecimalCR"></span>bool <code class="descname">operator!=</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalltERK1TRK7Decimal">
<span id="_CPPv3N7decimalltERK1TRK7Decimal"></span><span id="_CPPv2N7decimalltERK1TRK7Decimal"></span><span id="decimal::lt-operator__TCR.DecimalCR"></span>bool <code class="descname">operator&lt;</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalleERK1TRK7Decimal">
<span id="_CPPv3N7decimalleERK1TRK7Decimal"></span><span id="_CPPv2N7decimalleERK1TRK7Decimal"></span><span id="decimal::lte-operator__TCR.DecimalCR"></span>bool <code class="descname">operator&lt;=</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalgeERK1TRK7Decimal">
<span id="_CPPv3N7decimalgeERK1TRK7Decimal"></span><span id="_CPPv2N7decimalgeERK1TRK7Decimal"></span><span id="decimal::gte-operator__TCR.DecimalCR"></span>bool <code class="descname">operator&gt;=</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalgtERK1TRK7Decimal">
<span id="_CPPv3N7decimalgtERK1TRK7Decimal"></span><span id="_CPPv2N7decimalgtERK1TRK7Decimal"></span><span id="decimal::gt-operator__TCR.DecimalCR"></span>bool <code class="descname">operator&gt;</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

</div></blockquote>
</div>
<div class="section" id="unary-arithmetic-operators">
<h2>Unary arithmetic operators</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimalmiEv">
<span id="_CPPv3NK7decimalmiEv"></span><span id="_CPPv2NK7decimalmiEv"></span><span id="decimal::sub-operatorC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Negate the input operand.  This function is equivalent to <cite>Decimal.minus</cite> and
applies the thread local context.  Note that positive zeros keep their sign,
unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalplEv">
<span id="_CPPv3NK7decimalplEv"></span><span id="_CPPv2NK7decimalplEv"></span><span id="decimal::add-operatorC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the input operand after applying the thread local context.  This function is equivalent
to <cite>Decimal.plus</cite>.  Note that negative zeros lose their sign, unless the rounding is set to
<cite>ROUND_FLOOR</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="binary-arithmetic-operators">
<h2>Binary arithmetic operators</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimalplERK7Decimal">
<span id="_CPPv3NK7decimalplERK7Decimal"></span><span id="_CPPv2NK7decimalplERK7Decimal"></span><span id="decimal::add-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self + other</cite>.  The operation is performed on the unrounded input operands
and has a single final rounding step.  The thread local context is used.</p>
<p>Same as <cite>self.add(other, context)</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalmiERK7Decimal">
<span id="_CPPv3NK7decimalmiERK7Decimal"></span><span id="_CPPv2NK7decimalmiERK7Decimal"></span><span id="decimal::sub-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self - other</cite>.  The operation is performed on the unrounded input operands
and has a single final rounding step.  The thread local context is used.</p>
<p>Same as <cite>self.sub(other, context)</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalmlERK7Decimal">
<span id="_CPPv3NK7decimalmlERK7Decimal"></span><span id="_CPPv2NK7decimalmlERK7Decimal"></span><span id="decimal::mul-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator*</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self * other</cite>.  The operation is performed on the unrounded input operands
and has a single final rounding step.  The thread local context is used.</p>
<p>Same as <cite>self.mul(other, context)</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimaldvERK7Decimal">
<span id="_CPPv3NK7decimaldvERK7Decimal"></span><span id="_CPPv2NK7decimaldvERK7Decimal"></span><span id="decimal::div-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator/</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self / other</cite>.  The operation is performed on the unrounded input operands
and has a single final rounding step.  The thread local context is used.</p>
<p>Same as <cite>self.div(other, context)</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimalrmERK7Decimal">
<span id="_CPPv3NK7decimalrmERK7Decimal"></span><span id="_CPPv2NK7decimalrmERK7Decimal"></span><span id="decimal::mod-operator__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator%</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self % other</cite>.  The operation is performed on the unrounded input operands
and has a single final rounding step.  The thread local context is used.</p>
<p>Same as <cite>self.rem(other, context)</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="reverse-binary-arithmetic-operators">
<h2>Reverse binary arithmetic operators</h2>
<blockquote>
<div><p>Reverse binary arithmetic operators. <cite>T</cite> is one of:</p>
<blockquote>
<div><table border="1" class="docutils align-default">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><cite>int8_t</cite></td>
<td><cite>uint8_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int16_t</cite></td>
<td><cite>uint16_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>int32_t</cite></td>
<td><cite>uint32_t</cite></td>
</tr>
<tr class="row-even"><td><cite>int64_t</cite></td>
<td><cite>uint64_t</cite></td>
</tr>
<tr class="row-odd"><td><cite>signed char</cite></td>
<td><cite>unsigned char</cite></td>
</tr>
<tr class="row-even"><td><cite>short</cite></td>
<td><cite>unsigned short</cite></td>
</tr>
<tr class="row-odd"><td><cite>int</cite></td>
<td><cite>unsigned int</cite></td>
</tr>
<tr class="row-even"><td><cite>long</cite></td>
<td><cite>unsigned long</cite></td>
</tr>
<tr class="row-odd"><td><cite>long long</cite></td>
<td><cite>unsigned long long</cite></td>
</tr>
</tbody>
</table>
</div></blockquote>
<dl class="function">
<dt id="_CPPv4N7decimalplERK1TRK7Decimal">
<span id="_CPPv3N7decimalplERK1TRK7Decimal"></span><span id="_CPPv2N7decimalplERK1TRK7Decimal"></span><span id="decimal::add-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator+</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalmiERK1TRK7Decimal">
<span id="_CPPv3N7decimalmiERK1TRK7Decimal"></span><span id="_CPPv2N7decimalmiERK1TRK7Decimal"></span><span id="decimal::sub-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator-</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalmlERK1TRK7Decimal">
<span id="_CPPv3N7decimalmlERK1TRK7Decimal"></span><span id="_CPPv2N7decimalmlERK1TRK7Decimal"></span><span id="decimal::mul-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator*</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimaldvERK1TRK7Decimal">
<span id="_CPPv3N7decimaldvERK1TRK7Decimal"></span><span id="_CPPv2N7decimaldvERK1TRK7Decimal"></span><span id="decimal::div-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator/</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimalrmERK1TRK7Decimal">
<span id="_CPPv3N7decimalrmERK1TRK7Decimal"></span><span id="_CPPv2N7decimalrmERK1TRK7Decimal"></span><span id="decimal::mod-operator__TCR.DecimalCR"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">operator%</code><span class="sig-paren">(</span><em class="property">const</em> T &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd></dd></dl>

</div></blockquote>
</div>
<div class="section" id="predicates">
<h2>Predicates</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal8isfiniteEv">
<span id="_CPPv3NK7decimal8isfiniteEv"></span><span id="_CPPv2NK7decimal8isfiniteEv"></span><span id="decimal::isfiniteC"></span>bool <code class="descname">isfinite</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a finite number, and <cite>false</cite> if <cite>self</cite>
is infinite or a quiet or signaling <cite>NaN</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal10isinfiniteEv">
<span id="_CPPv3NK7decimal10isinfiniteEv"></span><span id="_CPPv2NK7decimal10isinfiniteEv"></span><span id="decimal::isinfiniteC"></span>bool <code class="descname">isinfinite</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is either a positive or negative infinity and
<cite>false</cite> otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9isspecialEv">
<span id="_CPPv3NK7decimal9isspecialEv"></span><span id="_CPPv2NK7decimal9isspecialEv"></span><span id="decimal::isspecialC"></span>bool <code class="descname">isspecial</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return true if <cite>self</cite> is a quiet or signaling <cite>NaN</cite> or infinite, <cite>false</cite>
otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5isnanEv">
<span id="_CPPv3NK7decimal5isnanEv"></span><span id="_CPPv2NK7decimal5isnanEv"></span><span id="decimal::isnanC"></span>bool <code class="descname">isnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a quiet or signaling <cite>NaN</cite> and <cite>false</cite>
otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6isqnanEv">
<span id="_CPPv3NK7decimal6isqnanEv"></span><span id="_CPPv2NK7decimal6isqnanEv"></span><span id="decimal::isqnanC"></span>bool <code class="descname">isqnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a quiet <cite>NaN</cite>, and <cite>false</cite> otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6issnanEv">
<span id="_CPPv3NK7decimal6issnanEv"></span><span id="_CPPv2NK7decimal6issnanEv"></span><span id="decimal::issnanC"></span>bool <code class="descname">issnan</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a signaling <cite>NaN</cite> and <cite>false</cite> otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8issignedEv">
<span id="_CPPv3NK7decimal8issignedEv"></span><span id="_CPPv2NK7decimal8issignedEv"></span><span id="decimal::issignedC"></span>bool <code class="descname">issigned</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> has a negative sign and <cite>false</cite> otherwise.
Note that both zeros and <cite>NaNs</cite> can carry signs.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6iszeroEv">
<span id="_CPPv3NK7decimal6iszeroEv"></span><span id="_CPPv2NK7decimal6iszeroEv"></span><span id="decimal::iszeroC"></span>bool <code class="descname">iszero</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a positive or negative zero, <cite>false</cite> otherwise.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9isintegerEv">
<span id="_CPPv3NK7decimal9isintegerEv"></span><span id="_CPPv2NK7decimal9isintegerEv"></span><span id="decimal::isintegerC"></span>bool <code class="descname">isinteger</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Determine whether <cite>self</cite> is an integer. The exponent of an integer is not
necessarily zero and may be negative if the coefficient has trailing zeros.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="predicates-with-an-optional-context-argument">
<h2>Predicates with an optional context argument</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimal8isnormalERK7Context">
<span id="_CPPv3N7decimal8isnormalERK7Context"></span><span id="_CPPv2N7decimal8isnormalERK7Context"></span><span id="decimal::isnormal__ContextCR"></span>bool <code class="descname">isnormal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is a normal finite non-zero number with an adjusted
exponent greater than or equal to <cite>emin</cite>. Return <cite>false</cite> if <cite>self</cite> is zero,
subnormal, infinite or a quiet or signaling <cite>NaN</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal11issubnormalERK7Context">
<span id="_CPPv3N7decimal11issubnormalERK7Context"></span><span id="_CPPv2N7decimal11issubnormalERK7Context"></span><span id="decimal::issubnormal__ContextCR"></span>bool <code class="descname">issubnormal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span><br /></dt>
<dd><p>Return <cite>true</cite> if <cite>self</cite> is subnormal, and <cite>false</cite> otherwise. A number is
subnormal if it is non-zero, finite, and has an adjusted exponent less
than <cite>emin</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="unary-functions-no-context-argument">
<h2>Unary functions, no context argument</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal6adjexpEv">
<span id="_CPPv3NK7decimal6adjexpEv"></span><span id="_CPPv2NK7decimal6adjexpEv"></span><span id="decimal::adjexpC"></span>int64_t <code class="descname">adjexp</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the adjusted exponent of <cite>self</cite>. Defined as exp + digits - 1.
Raises <cite>ValueError</cite> for special values.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8copy_absEv">
<span id="_CPPv3NK7decimal8copy_absEv"></span><span id="_CPPv2NK7decimal8copy_absEv"></span><span id="decimal::copy_absC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_abs</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return an exact copy of the absolute value of <cite>self</cite>.  In contrast to
<cite>Decimal.abs</cite>, this function does not use the thread local context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal11copy_negateEv">
<span id="_CPPv3NK7decimal11copy_negateEv"></span><span id="_CPPv2NK7decimal11copy_negateEv"></span><span id="decimal::copy_negateC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_negate</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return an exact copy of the negation of <cite>self</cite>.  In contrast to <cite>-self</cite>,
this function does not use the thread local context.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="unary-functions-optional-context-argument">
<h2>Unary functions, optional context argument</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimal12number_classER7Context">
<span id="_CPPv3N7decimal12number_classER7Context"></span><span id="_CPPv2N7decimal12number_classER7Context"></span><span id="decimal::number_class__ContextR"></span>std::string <code class="descname">number_class</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span><br /></dt>
<dd><p>Return a string describing the class of the operand.  The returned value
is one of the following ten strings:</p>
<ul class="simple">
<li>“-Infinity”, indicating that the operand is negative infinity.</li>
<li>“-Normal”, indicating that the operand is a negative normal number.</li>
<li>“-Subnormal”, indicating that the operand is negative and subnormal.</li>
<li>“-Zero”, indicating that the operand is a negative zero.</li>
<li>“+Zero”, indicating that the operand is a positive zero.</li>
<li>“+Subnormal”, indicating that the operand is positive and subnormal.</li>
<li>“+Normal”, indicating that the operand is a positive normal number.</li>
<li>“+Infinity”, indicating that the operand is positive infinity.</li>
<li>“NaN”, indicating that the operand is a quiet <cite>NaN</cite> (Not a Number).</li>
<li>“sNaN”, indicating that the operand is a signaling <cite>NaN`</cite>.</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3absER7Context">
<span id="_CPPv3NK7decimal3absER7Context"></span><span id="_CPPv2NK7decimal3absER7Context"></span><span id="decimal::abs__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">abs</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the absolute value of x.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4ceilER7Context">
<span id="_CPPv3NK7decimal4ceilER7Context"></span><span id="_CPPv2NK7decimal4ceilER7Context"></span><span id="decimal::ceil__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ceil</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the ceiling of <cite>self</cite>. Not part of the standard.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3expER7Context">
<span id="_CPPv3NK7decimal3expER7Context"></span><span id="_CPPv2NK7decimal3expER7Context"></span><span id="decimal::exp__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exp</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the value of the exponential function <cite>e**x</cite> at the given
number.  The function always uses the <cite>ROUND_HALF_EVEN</cite> mode.</p>
<p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5floorER7Context">
<span id="_CPPv3NK7decimal5floorER7Context"></span><span id="_CPPv2NK7decimal5floorER7Context"></span><span id="decimal::floor__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">floor</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the floor of <cite>self</cite>. Not part of the standard.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7invrootER7Context">
<span id="_CPPv3NK7decimal7invrootER7Context"></span><span id="_CPPv2NK7decimal7invrootER7Context"></span><span id="decimal::invroot__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">invroot</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the reciprocal of the square root of <cite>self</cite>. The function always
uses the <cite>ROUND_HALF_EVEN</cite> mode. Results are not correctly rounded, even
if the <cite>allcr</cite> context field is set to 1. This might change in a future
release.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal2lnER7Context">
<span id="_CPPv3NK7decimal2lnER7Context"></span><span id="_CPPv2NK7decimal2lnER7Context"></span><span id="decimal::ln__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ln</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the natural (base <cite>e</cite>) logarithm of the operand. The function always
uses the <cite>ROUND_HALF_EVEN</cite> mode.</p>
<p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5log10ER7Context">
<span id="_CPPv3NK7decimal5log10ER7Context"></span><span id="_CPPv2NK7decimal5log10ER7Context"></span><span id="decimal::log10__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">log10</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the base ten logarithm of the operand. The function always uses the
<cite>ROUND_HALF_EVEN</cite> mode.</p>
<p>If <cite>c.allcr() == 1</cite>, the result is always correctly rounded.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4logbER7Context">
<span id="_CPPv3NK7decimal4logbER7Context"></span><span id="_CPPv2NK7decimal4logbER7Context"></span><span id="decimal::logb__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logb</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>For a non-zero number, return the adjusted exponent of the operand as a
Decimal instance.  If the operand is a zero, then <cite>Decimal(“-Infinity”)</cite> is
returned and the <cite>DivisionByZero</cite> condition is raised. If the operand is
an infinity then <cite>Decimal(“Infinity”)</cite> is returned.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5minusER7Context">
<span id="_CPPv3NK7decimal5minusER7Context"></span><span id="_CPPv2NK7decimal5minusER7Context"></span><span id="decimal::minus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">minus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Negate the input operand and apply the context. Note that positive zeros keep
their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal10next_minusER7Context">
<span id="_CPPv3NK7decimal10next_minusER7Context"></span><span id="_CPPv2NK7decimal10next_minusER7Context"></span><span id="decimal::next_minus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_minus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the largest number representable in the given context that is
smaller than the given operand.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9next_plusER7Context">
<span id="_CPPv3NK7decimal9next_plusER7Context"></span><span id="_CPPv2NK7decimal9next_plusER7Context"></span><span id="decimal::next_plus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_plus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the smallest number representable in the given context that is
larger than the given operand.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4plusER7Context">
<span id="_CPPv3NK7decimal4plusER7Context"></span><span id="_CPPv2NK7decimal4plusER7Context"></span><span id="decimal::plus__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">plus</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Copy the input operand and apply the context. Note that negative zeros lose
their sign, unless the rounding is set to <cite>ROUND_FLOOR</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6reduceER7Context">
<span id="_CPPv3NK7decimal6reduceER7Context"></span><span id="_CPPv2NK7decimal6reduceER7Context"></span><span id="decimal::reduce__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">reduce</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Normalize the number by stripping the rightmost trailing zeros and
converting any result equal to <cite>Decimal(“0”)</cite> to <cite>Decimal(“0e0”)</cite>.</p>
<p>Used for producing representative values for members of an equivalence
class.  For example, Decimal(“32.100”) and Decimal(“0.321000e+2”) both
normalize to the equivalent value Decimal(“32.1”).</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal11to_integralER7Context">
<span id="_CPPv3NK7decimal11to_integralER7Context"></span><span id="_CPPv2NK7decimal11to_integralER7Context"></span><span id="decimal::to_integral__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">to_integral</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Round to the nearest integer without signaling Inexact or Rounded.
The rounding mode is determined by the by the given context.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal17to_integral_exactER7Context">
<span id="_CPPv3NK7decimal17to_integral_exactER7Context"></span><span id="_CPPv2NK7decimal17to_integral_exactER7Context"></span><span id="decimal::to_integral_exact__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">to_integral_exact</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Round to the nearest integer, signaling <cite>Inexact</cite> or <cite>Rounded</cite> as
appropriate if rounding occurs. The rounding mode is determined by
the rounding parameter if given, else by the given context. If neither
parameter is given, then the rounding mode of the current default
context is used.</p>
<p>Note that the use of <cite>exact</cite> in this name is determined by the
specification and differs from the terminology in <cite>libmpdec++</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4sqrtER7Context">
<span id="_CPPv3NK7decimal4sqrtER7Context"></span><span id="_CPPv2NK7decimal4sqrtER7Context"></span><span id="decimal::sqrt__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">sqrt</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the square root of <cite>self</cite> to context precision. The rounding mode is
always <cite>ROUND_HALF_EVEN</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5truncER7Context">
<span id="_CPPv3NK7decimal5truncER7Context"></span><span id="_CPPv2NK7decimal5truncER7Context"></span><span id="decimal::trunc__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">trunc</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self</cite>, truncated towards zero.  Not part of the standard.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="binary-functions-no-context-argument">
<h2>Binary functions, no context argument</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal13compare_totalERK7Decimal">
<span id="_CPPv3NK7decimal13compare_totalERK7Decimal"></span><span id="_CPPv2NK7decimal13compare_totalERK7Decimal"></span><span id="decimal::compare_total__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_total</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Compare two operands using their abstract representation rather than
their numerical value.  Similar to <cite>Decimal.compare</cite>, but the result
gives a total ordering on Decimal instances.  Two Decimal instances with
the same numeric value but different representations compare unequal
in this ordering:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;12.0&quot;</span><span class="p">).</span><span class="n">compare_total</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;12&quot;</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;-1&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Quiet and signaling NaNs are also included in the total ordering. The result
of this function is Decimal(“0”) if both operands have the same representation,
Decimal(“-1”) if the first operand is lower in the total order than the second,
and Decimal(“1”) if the first operand is higher in the total order than the
second operand. See the specification for details of the total order.</p>
<p>This operation is unaffected by context and is quiet: no flags are changed
and no rounding is performed.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal17compare_total_magERK7Decimal">
<span id="_CPPv3NK7decimal17compare_total_magERK7Decimal"></span><span id="_CPPv2NK7decimal17compare_total_magERK7Decimal"></span><span id="decimal::compare_total_mag__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_total_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Compare two operands using their abstract representation rather than their
value as in <cite>Decimal.compare_total</cite>, but ignoring the sign of each operand.</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">x</span><span class="p">.</span><span class="n">compare_total_mag</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">==</span> <span class="n">x</span><span class="p">.</span><span class="n">copy_abs</span><span class="p">().</span><span class="n">compare_total</span><span class="p">(</span><span class="n">y</span><span class="p">.</span><span class="n">copy_abs</span><span class="p">())</span>
</pre></div>
</div>
<p>This operation is unaffected by context and is quiet: no flags are changed
and no rounding is performed.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="binary-functions-optional-context-argument">
<h2>Binary functions, optional context argument</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal3addERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3addERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3addERK7DecimalR7Context"></span><span id="decimal::add__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">add</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the sum of <cite>self</cite> and <cite>other</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3divERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3divERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3divERK7DecimalR7Context"></span><span id="decimal::div__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">div</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self</cite> divided by other.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6divintERK7DecimalR7Context">
<span id="_CPPv3NK7decimal6divintERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6divintERK7DecimalR7Context"></span><span id="decimal::divint__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">divint</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self</cite> divided by <cite>other</cite>, truncated to an integer.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7compareERK7DecimalR7Context">
<span id="_CPPv3NK7decimal7compareERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7compareERK7DecimalR7Context"></span><span id="decimal::compare__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Compare self to other. Return a decimal value:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">a</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="n">InvalidOperation</span>
<span class="n">a</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;NaN&quot;</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&lt;</span> <span class="n">b</span>                    <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;-1&quot;</span><span class="p">)</span>
<span class="n">a</span> <span class="o">==</span> <span class="n">b</span>                   <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;0&quot;</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&gt;</span> <span class="n">b</span>                    <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;1&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal14compare_signalERK7DecimalR7Context">
<span id="_CPPv3NK7decimal14compare_signalERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal14compare_signalERK7DecimalR7Context"></span><span id="decimal::compare_signal__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">compare_signal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Compare self to other. Return a decimal value:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">a</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">issnan</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="n">InvalidOperation</span>
<span class="n">a</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">||</span> <span class="n">b</span><span class="o">.</span><span class="n">isqnan</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="n">InvalidOperation</span>
<span class="n">a</span> <span class="o">&lt;</span> <span class="n">b</span>                    <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;-1&quot;</span><span class="p">)</span>
<span class="n">a</span> <span class="o">==</span> <span class="n">b</span>                   <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;0&quot;</span><span class="p">)</span>
<span class="n">a</span> <span class="o">&gt;</span> <span class="n">b</span>                    <span class="o">=&gt;</span> <span class="n">Decimal</span><span class="p">(</span><span class="s2">&quot;1&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3maxERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3maxERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3maxERK7DecimalR7Context"></span><span id="decimal::max__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">max</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Maximum of <cite>self</cite> and <cite>other</cite>. NOTE: If one operand is a quiet <cite>NaN</cite> and
the other is numeric, the numeric operand is returned.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7max_magERK7DecimalR7Context">
<span id="_CPPv3NK7decimal7max_magERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7max_magERK7DecimalR7Context"></span><span id="decimal::max_mag__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">max_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Similar to <cite>Decimal.max</cite>, but the comparison is done using the absolute
values of the operands.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3minERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3minERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3minERK7DecimalR7Context"></span><span id="decimal::min__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">min</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Minimum of <cite>self</cite> and <cite>other</cite>. NOTE: If one operand is a quiet NaN and
the other is numeric, the numeric operand is returned.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7min_magERK7DecimalR7Context">
<span id="_CPPv3NK7decimal7min_magERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal7min_magERK7DecimalR7Context"></span><span id="decimal::min_mag__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">min_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Similar to <cite>Decimal.min</cite>, but the comparison is done using the absolute
values of the operands.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3mulERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3mulERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3mulERK7DecimalR7Context"></span><span id="decimal::mul__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">mul</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the product of <cite>self</cite> and <cite>other</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal11next_towardERK7DecimalR7Context">
<span id="_CPPv3NK7decimal11next_towardERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11next_towardERK7DecimalR7Context"></span><span id="decimal::next_toward__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">next_toward</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>If the two operands are unequal, return the number closest to the first
operand in the direction of the second operand.  If both operands are
numerically equal, return a copy of the first operand with the sign set
to be the same as the sign of the second operand.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3powERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3powERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3powERK7DecimalR7Context"></span><span id="decimal::pow__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">pow</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Compute <cite>self</cite> raised to the power of <cite>other</cite>. If <cite>self</cite> is negative, then
<cite>other</cite> must be integral. The result will be inexact unless <cite>self</cite> is integral
and the result is finite and can be expressed exactly in <cite>prec</cite> digits.</p>
<p>The result is almost always correctly rounded, but correct rounding is not
guaranteed even if <cite>c.allcr()</cite> is set.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8quantizeERK7DecimalR7Context">
<span id="_CPPv3NK7decimal8quantizeERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal8quantizeERK7DecimalR7Context"></span><span id="decimal::quantize__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">quantize</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a value equal to <cite>self</cite> after rounding and having the exponent of
the second operand.</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;1.41421356&quot;</span><span class="p">).</span><span class="n">quantize</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;1.000&quot;</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;1.414&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Unlike other operations, if the length of the coefficient after the quantize
operation would be greater than precision, then <cite>InvalidOperation</cite> is set.</p>
<p>This guarantees that, unless there is an error condition, the quantized exponent
is always equal to that of the right-hand operand.</p>
<p>Also unlike other operations, quantize never sets Underflow, even if the
result is subnormal and inexact.</p>
<p>If the exponent of the second operand is larger than that of the first, then
rounding may be necessary. In this case, the rounding mode is determined by the
the given context argument.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3remERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3remERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3remERK7DecimalR7Context"></span><span id="decimal::rem__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rem</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>The remainder from the division by <cite>Decimal.divint</cite>.  Fails under the same
conditions as <cite>Decimal.divint</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal8rem_nearERK7DecimalR7Context">
<span id="_CPPv3NK7decimal8rem_nearERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal8rem_nearERK7DecimalR7Context"></span><span id="decimal::rem_near__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rem_near</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>self - other * n</cite>, where <cite>n</cite> is the integer nearest the exact value of
<cite>self / other</cite>.  If the result is 0 then its sign will be the sign of <cite>self</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6scalebERK7DecimalR7Context">
<span id="_CPPv3NK7decimal6scalebERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6scalebERK7DecimalR7Context"></span><span id="decimal::scaleb__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">scaleb</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the <cite>self</cite> with the exponent adjusted by the value of <cite>other</cite>.  Equivalently,
return the first operand multiplied by <cite>10 ** other</cite>. The second operand must be
an integer.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3subERK7DecimalR7Context">
<span id="_CPPv3NK7decimal3subERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3subERK7DecimalR7Context"></span><span id="decimal::sub__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">sub</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the difference between <cite>self</cite> and <cite>other</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="binary-functions-two-return-values">
<h2>Binary functions, two return values</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal6divmodERK7DecimalR7Context">
<span id="_CPPv3NK7decimal6divmodERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6divmodERK7DecimalR7Context"></span><span id="decimal::divmod__DecimalCR.ContextRC"></span>std::pair&lt;<a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a>, <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a>&gt; <code class="descname">divmod</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return quotient and remainder of the division <cite>self / other</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="ternary-functions">
<h2>Ternary functions</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal3fmaERK7DecimalRK7DecimalR7Context">
<span id="_CPPv3NK7decimal3fmaERK7DecimalRK7DecimalR7Context"></span><span id="_CPPv2NK7decimal3fmaERK7DecimalRK7DecimalR7Context"></span><span id="decimal::fma__DecimalCR.DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">fma</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>third</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Fused multiply-add.  Return <cite>self * other + third</cite> with no rounding of
the intermediate product <cite>self * other</cite>.</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="mi">2</span><span class="p">).</span><span class="n">fma</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="mi">11</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6powmodERK7DecimalRK7DecimalR7Context">
<span id="_CPPv3NK7decimal6powmodERK7DecimalRK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6powmodERK7DecimalRK7DecimalR7Context"></span><span id="decimal::powmod__DecimalCR.DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">powmod</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>third</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p><cite>self ** other % third</cite>. The following restrictions hold:</p>
<ul class="simple">
<li>All three arguments must be integral.</li>
<li><cite>other</cite> must be nonnegative.</li>
<li>At least one of <cite>self</cite> or <cite>other</cite> must be nonzero.</li>
<li><cite>third</cite> must be nonzero and less than <cite>10 ** prec</cite> in absolute value.</li>
</ul>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="irregular-functions">
<h2>Irregular functions</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal5applyER7Context">
<span id="_CPPv3NK7decimal5applyER7Context"></span><span id="_CPPv2NK7decimal5applyER7Context"></span><span id="decimal::apply__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">apply</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a copy of <cite>self</cite> with the given context applied. This directly wraps <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">mpd_finalize</span></code>.
It is very similar to <cite>Decimal.plus</cite>, but does not have special rules for zeros.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3cmpERK7Decimal">
<span id="_CPPv3NK7decimal3cmpERK7Decimal"></span><span id="_CPPv2NK7decimal3cmpERK7Decimal"></span><span id="decimal::cmp__DecimalCRC"></span>int <code class="descname">cmp</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Same as <cite>Decimal.compare_signal</cite>, but with an integer return value. Return
<cite>INT_MAX</cite> if any operand is <cite>NaN</cite>.  Not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9cmp_totalERK7Decimal">
<span id="_CPPv3NK7decimal9cmp_totalERK7Decimal"></span><span id="_CPPv2NK7decimal9cmp_totalERK7Decimal"></span><span id="decimal::cmp_total__DecimalCRC"></span>int <code class="descname">cmp_total</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Same as <cite>Decimal.compare_total</cite>, but with an integer return value.
Not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal13cmp_total_magERK7Decimal">
<span id="_CPPv3NK7decimal13cmp_total_magERK7Decimal"></span><span id="_CPPv2NK7decimal13cmp_total_magERK7Decimal"></span><span id="decimal::cmp_total_mag__DecimalCRC"></span>int <code class="descname">cmp_total_mag</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Same as <cite>Decimal.compare_total_mag</cite>, but with an integer return value.
Not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9copy_signERK7Decimal">
<span id="_CPPv3NK7decimal9copy_signERK7Decimal"></span><span id="_CPPv2NK7decimal9copy_signERK7Decimal"></span><span id="decimal::copy_sign__DecimalCRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy_sign</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a copy of the first operand with the sign set to be the same as the
sign of the second operand. For example:</p>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;2.3&quot;</span><span class="p">).</span><span class="n">copy_sign</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;-1.5&quot;</span><span class="p">))</span> <span class="o">==</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;-2.3&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal7rescaleEK7int64_tR7Context">
<span id="_CPPv3NK7decimal7rescaleEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal7rescaleEK7int64_tR7Context"></span><span id="decimal::rescale__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rescale</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>exp</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the number that is equal in value to <cite>self</cite>, but has the exponent <cite>exp</cite>.
Special numbers are copied without signaling. This function is not part of the
standard. It is also not equivalent to the <cite>rescale</cite> function that was removed
from the standard.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal12same_quantumERK7Decimal">
<span id="_CPPv3NK7decimal12same_quantumERK7Decimal"></span><span id="_CPPv2NK7decimal12same_quantumERK7Decimal"></span><span id="decimal::same_quantum__DecimalCRC"></span>bool <code class="descname">same_quantum</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Test whether self and other have the same exponent or whether both are <cite>NaN</cite>.</p>
<p>This operation is unaffected by context and is quiet: no flags are changed
and no rounding is performed.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6shiftlEK7int64_tR7Context">
<span id="_CPPv3NK7decimal6shiftlEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftlEK7int64_tR7Context"></span><span id="decimal::shiftl__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftl</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a copy of <cite>self</cite>, with its coefficient shifted by <cite>n</cite> places to
the left. <cite>self</cite> must not be a special number. Digits are never discarded,
so the coefficient of the result might exceed <cite>prec</cite>.</p>
<p>This function is not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6shiftrEK7int64_tR7Context">
<span id="_CPPv3NK7decimal6shiftrEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftrEK7int64_tR7Context"></span><span id="decimal::shiftr__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftr</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return a copy of <cite>self</cite>, with its coefficient shifted by <cite>n</cite> places to
the right.</p>
<p>This function is not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal5exactEPCKcR7Context">
<span id="_CPPv3N7decimal5exactEPCKcR7Context"></span><span id="_CPPv2N7decimal5exactEPCKcR7Context"></span><span id="decimal::exact__cCPC.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exact</code><span class="sig-paren">(</span><em class="property">const</em> char *<em class="property">const</em> <em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>This constructs an exact decimal from a <cite>C</cite> string.  The context is only passed
for error reporting in case the internal limits are exceeded.</p>
<p>This is a convenience function that is rarely used.  Not part of the specification.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal5exactERKNSt6stringER7Context">
<span id="_CPPv3N7decimal5exactERKNSt6stringER7Context"></span><span id="_CPPv2N7decimal5exactERKNSt6stringER7Context"></span><span id="decimal::exact__ssCR.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">exact</code><span class="sig-paren">(</span><em class="property">const</em> std::string &amp;<em>s</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em><span class="sig-paren">)</span><br /></dt>
<dd><p>Same as above, except for the argument type.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal4ln10E7int64_tR7Context">
<span id="_CPPv3N7decimal4ln10E7int64_tR7Context"></span><span id="_CPPv2N7decimal4ln10E7int64_tR7Context"></span><span id="decimal::ln10__int64_t.ContextR"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">ln10</code><span class="sig-paren">(</span>int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span><br /></dt>
<dd><p>Compute <cite>ln(10)</cite> to <cite>n</cite> digits of precision.  Rounding is always <cite>ROUND_HALF_EVEN</cite>.</p>
<p>If <cite>c.allcr()</cite> is set, the result is correctly rounded.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-integer-conversion">
<h2>Exact integer conversion</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal3i64Ev">
<span id="_CPPv3NK7decimal3i64Ev"></span><span id="_CPPv2NK7decimal3i64Ev"></span><span id="decimal::i64C"></span>int64_t <code class="descname">i64</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Convert a Decimal that is exactly representable as an <cite>int64_t</cite>. In case of
failure, raise <cite>ValueError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3i32Ev">
<span id="_CPPv3NK7decimal3i32Ev"></span><span id="_CPPv2NK7decimal3i32Ev"></span><span id="decimal::i32C"></span>int32_t <code class="descname">i32</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Convert a Decimal that is exactly representable as an <cite>int32_t</cite>. In case of
failure, raise <cite>ValueError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3u64Ev">
<span id="_CPPv3NK7decimal3u64Ev"></span><span id="_CPPv2NK7decimal3u64Ev"></span><span id="decimal::u64C"></span>uint64_t <code class="descname">u64</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Convert a Decimal that is exactly representable as a <cite>uint64_t</cite>. In case of
failure, raise <cite>ValueError</cite>.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal3u32Ev">
<span id="_CPPv3NK7decimal3u32Ev"></span><span id="_CPPv2NK7decimal3u32Ev"></span><span id="decimal::u32C"></span>uint32_t <code class="descname">u32</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Convert a Decimal that is exactly representable as a <cite>uint32_t</cite>. In case of
failure, raise <cite>ValueError</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-triple-conversion">
<h2>Exact triple conversion</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal17as_uint128_tripleEv">
<span id="_CPPv3NK7decimal17as_uint128_tripleEv"></span><span id="_CPPv2NK7decimal17as_uint128_tripleEv"></span><span id="decimal::as_uint128_tripleC"></span>mpd_uint128_triple_t <code class="descname">as_uint128_triple</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Exact conversion to an <cite>mpd_uint128_triple_t</cite>.  The triple can represent
Decimals with a coefficient up to 38 decimal digits. Refer to the <cite>libmpdec</cite>
documentation for details on how to handle the return value and errors
(See: <cite>mpd_as_uint128_triple</cite>).</p>
<p>Raises <cite>InvalidOperation</cite> if the coefficient is too large.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="exact-string-conversion">
<h2>Exact string conversion</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal4reprEb">
<span id="_CPPv3NK7decimal4reprEb"></span><span id="_CPPv2NK7decimal4reprEb"></span><span id="decimal::repr__bC"></span>std::string <code class="descname">repr</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Same as <cite>Decimal.to_sci</cite>, but wrap the string in a constructor.</p>
<blockquote>
<div><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">Decimal</span><span class="p">(</span><span class="s">&quot;1.234E+100&quot;</span><span class="p">).</span><span class="n">repr</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Decimal(</span><span class="se">\&quot;</span><span class="s">1.234E+100</span><span class="se">\&quot;</span><span class="s">)&quot;</span>
</pre></div>
</div>
</div></blockquote>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6to_sciEb">
<span id="_CPPv3NK7decimal6to_sciEb"></span><span id="_CPPv2NK7decimal6to_sciEb"></span><span id="decimal::to_sci__bC"></span>std::string <code class="descname">to_sci</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the scientific string representation of a Decimal.  This operation
is not context sensitive. If <cite>capitals</cite> is <cite>false</cite>, the exponent character
is lower case, otherwise it is upper case.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6to_engEb">
<span id="_CPPv3NK7decimal6to_engEb"></span><span id="_CPPv2NK7decimal6to_engEb"></span><span id="decimal::to_eng__bC"></span>std::string <code class="descname">to_eng</code><span class="sig-paren">(</span>bool <em>capitals</em> = true<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the engineering string representation of a Decimal.  This operation
is not context sensitive. If <cite>capitals</cite> is <cite>false</cite>, the exponent character
is lower case, otherwise it is upper case.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="inexact-string-conversion">
<h2>Inexact string conversion</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal6formatEPKcRK7Context">
<span id="_CPPv3NK7decimal6formatEPKcRK7Context"></span><span id="_CPPv2NK7decimal6formatEPKcRK7Context"></span><span id="decimal::format__cCP.ContextCRC"></span>std::string <code class="descname">format</code><span class="sig-paren">(</span><em class="property">const</em> char *<em>fmt</em>, <em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the string representation of a decimal according to format string <cite>fmt</cite>.
The format string syntax is the same as in Python PEP 3101 (See Standard Format
Specifiers) and is quite similar to the syntax used for floating point numbers
the C <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">fprintf</span></code> function. The fill character may be a UTF-8 character,
the rest of the format string must be ASCII.</p>
<p>The function raises <cite>ValueError</cite> for an invalid format string or <cite>MallocError</cite>
in case of an allocation failure.</p>
<p>If the “n” format specifier is used, the function calls <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">localeconv</span></code>.
Depending on the guarantees of the system’s <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">localeconv</span></code>, this method
may require a lock.</p>
<p>All other format specifiers are thread-safe.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6formatERKNSt6stringERK7Context">
<span id="_CPPv3NK7decimal6formatERKNSt6stringERK7Context"></span><span id="_CPPv2NK7decimal6formatERKNSt6stringERK7Context"></span><span id="decimal::format__ssCR.ContextCRC"></span>std::string <code class="descname">format</code><span class="sig-paren">(</span><em class="property">const</em> std::string &amp;<em>s</em>, <em class="property">const</em> <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Same as above, using a string argument.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="streams">
<h2>Streams</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4N7decimallsERNSt7ostreamERK7Decimal">
<span id="_CPPv3N7decimallsERNSt7ostreamERK7Decimal"></span><span id="_CPPv2N7decimallsERNSt7ostreamERK7Decimal"></span><span id="decimal::lshift-operator__osR.DecimalCR"></span><em class="property">friend</em> std::ostream &amp;<code class="descname">operator&lt;&lt;</code><span class="sig-paren">(</span>std::ostream &amp;<em>os</em>, <em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>self</em><span class="sig-paren">)</span><br /></dt>
<dd><p>The conversion uses <cite>Decimal.to_sci</cite>.</p>
</dd></dl>

</div></blockquote>
</div>
<div class="section" id="required-by-the-specification">
<h2>Required by the specification</h2>
<blockquote>
<div><dl class="function">
<dt id="_CPPv4NK7decimal11iscanonicalEv">
<span id="_CPPv3NK7decimal11iscanonicalEv"></span><span id="_CPPv2NK7decimal11iscanonicalEv"></span><span id="decimal::iscanonicalC"></span>bool <code class="descname">iscanonical</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return <cite>true</cite>. This function is required by the specification, and the
representation of Decimals is always canonical.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal9canonicalEv">
<span id="_CPPv3NK7decimal9canonicalEv"></span><span id="_CPPv2NK7decimal9canonicalEv"></span><span id="decimal::canonicalC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">canonical</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return an exact copy of <cite>self</cite>.  No context is used.  Identical to the assignment operator.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal4copyEv">
<span id="_CPPv3NK7decimal4copyEv"></span><span id="_CPPv2NK7decimal4copyEv"></span><span id="decimal::copyC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return an exact copy of <cite>self</cite>.  No context is used.  Identical to the assignment operator.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal11logical_andERK7DecimalR7Context">
<span id="_CPPv3NK7decimal11logical_andERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11logical_andERK7DecimalR7Context"></span><span id="decimal::logical_and__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_and</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Digit-wise <cite>and</cite> of <cite>self</cite> and <cite>other</cite>.  All digits must be 0 or 1.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal14logical_invertER7Context">
<span id="_CPPv3NK7decimal14logical_invertER7Context"></span><span id="_CPPv2NK7decimal14logical_invertER7Context"></span><span id="decimal::logical_invert__ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_invert</code><span class="sig-paren">(</span><a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Invert the digits of <cite>self</cite>.  All digits must be 0 or 1.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal10logical_orERK7DecimalR7Context">
<span id="_CPPv3NK7decimal10logical_orERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal10logical_orERK7DecimalR7Context"></span><span id="decimal::logical_or__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_or</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Digit-wise <cite>or</cite> of <cite>self</cite> and <cite>other</cite>.  All digits must be 0 or 1.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal11logical_xorERK7DecimalR7Context">
<span id="_CPPv3NK7decimal11logical_xorERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal11logical_xorERK7DecimalR7Context"></span><span id="decimal::logical_xor__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">logical_xor</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Digit-wise <cite>xor</cite> of <cite>self</cite> and <cite>other</cite>.  All digits must be 0 or 1.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4N7decimal5radixEv">
<span id="_CPPv3N7decimal5radixEv"></span><span id="_CPPv2N7decimal5radixEv"></span><span id="decimal::radix"></span><em class="property">static</em> int32_t <code class="descname">radix</code><span class="sig-paren">(</span><span class="sig-paren">)</span><br /></dt>
<dd><p>Return 10.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6rotateERK7DecimalR7Context">
<span id="_CPPv3NK7decimal6rotateERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal6rotateERK7DecimalR7Context"></span><span id="decimal::rotate__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">rotate</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the result of rotating the digits of the first operand by an amount
specified by the second operand.  The second operand must be an integer in
the range -precision through precision. The absolute value of the second
operand gives the number of places to rotate. If the second operand is
positive then rotation is to the left; otherwise rotation is to the right
The coefficient of the first operand is padded on the left with zeros to
length precision if necessary. The sign and exponent of the first operand are
unchanged.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal5shiftERK7DecimalR7Context">
<span id="_CPPv3NK7decimal5shiftERK7DecimalR7Context"></span><span id="_CPPv2NK7decimal5shiftERK7DecimalR7Context"></span><span id="decimal::shift__DecimalCR.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shift</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> &amp;<em>other</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Return the result of shifting the digits of the <cite>self</cite> by an amount
specified by the <cite>other</cite>.  <cite>other</cite> must be an integer in the range
<cite>-prec through prec</cite>. The absolute value of the second operand gives
the number of places to shift. If <cite>self</cite> is positive, then the shift
is to the left; otherwise the shift is to the right. Digits shifted
into the coefficient are zeros. The sign and exponent are unchanged.</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv4NK7decimal6shiftnEK7int64_tR7Context">
<span id="_CPPv3NK7decimal6shiftnEK7int64_tR7Context"></span><span id="_CPPv2NK7decimal6shiftnEK7int64_tR7Context"></span><span id="decimal::shiftn__int64_tC.ContextRC"></span><a class="reference internal" href="#_CPPv4N7decimal7DecimalE" title="decimal::Decimal">Decimal</a> <code class="descname">shiftn</code><span class="sig-paren">(</span><em class="property">const</em> int64_t <em>n</em>, <a class="reference internal" href="context.html#_CPPv4N7decimal7ContextE" title="decimal::Context">Context</a> &amp;<em>c</em> = context<span class="sig-paren">)</span> <em class="property">const</em><br /></dt>
<dd><p>Like <cite>Decimal.shift</cite>, only that the number of places is specified by a
C integer type rather than a decimal. This function is not part of the
specification.</p>
</dd></dl>

</div></blockquote>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="context.html" title="Context"
             >previous</a></li>
    <li><a href="http://www.bytereef.org/mpdecimal/index.html">project home</a></li>
 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2010-2020, Stefan Krah.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.4.
    </div>
  </body>
</html>