File: Stdlib.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (2175 lines) | stat: -rw-r--r-- 128,858 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
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="StdLabels.html">
<link rel="next" href="Str.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Exceptions" rel="Section" href="#1_Exceptions">
<link title="Comparisons" rel="Section" href="#1_Comparisons">
<link title="Boolean operations" rel="Section" href="#1_Booleanoperations">
<link title="Debugging" rel="Section" href="#1_Debugging">
<link title="Composition operators" rel="Section" href="#1_Compositionoperators">
<link title="Integer arithmetic" rel="Section" href="#1_Integerarithmetic">
<link title="Floating-point arithmetic" rel="Section" href="#1_Floatingpointarithmetic">
<link title="String operations" rel="Section" href="#1_Stringoperations">
<link title="Character operations" rel="Section" href="#1_Characteroperations">
<link title="Unit operations" rel="Section" href="#1_Unitoperations">
<link title="String conversion functions" rel="Section" href="#1_Stringconversionfunctions">
<link title="Pair operations" rel="Section" href="#1_Pairoperations">
<link title="List operations" rel="Section" href="#1_Listoperations">
<link title="Input/output" rel="Section" href="#1_Inputoutput">
<link title="References" rel="Section" href="#1_References">
<link title="Result type" rel="Section" href="#1_Resulttype">
<link title="Operations on format strings" rel="Section" href="#1_Operationsonformatstrings">
<link title="Program termination" rel="Section" href="#1_Programtermination">
<link title="Standard library modules " rel="Section" href="#modules">
<link title="Bitwise operations" rel="Subsection" href="#2_Bitwiseoperations">
<link title="Output functions on standard output" rel="Subsection" href="#2_Outputfunctionsonstandardoutput">
<link title="Output functions on standard error" rel="Subsection" href="#2_Outputfunctionsonstandarderror">
<link title="Input functions on standard input" rel="Subsection" href="#2_Inputfunctionsonstandardinput">
<link title="General output functions" rel="Subsection" href="#2_Generaloutputfunctions">
<link title="General input functions" rel="Subsection" href="#2_Generalinputfunctions">
<link title="Operations on large files" rel="Subsection" href="#2_Operationsonlargefiles">
<title>Stdlib</title>
</head>
<body>
<div class="navbar"><a class="pre" href="StdLabels.html" title="StdLabels">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Str.html" title="Str">Next</a>
</div>
<h1>Module <a href="type_Stdlib.html">Stdlib</a></h1>

<pre><span id="MODULEStdlib"><span class="keyword">module</span> Stdlib</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Stdlib.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<div class="info-desc">
<p>The OCaml Standard library.</p>

<p>This module is automatically opened at the beginning of each
    compilation. All components of this module can therefore be
    referred by their short name, without prefixing them by <code class="code"><span class="constructor">Stdlib</span></code>.</p>

<p>It particular, it provides the basic operations over the built-in
    types (numbers, booleans, byte sequences, strings, exceptions,
    references, lists, arrays, input-output channels, ...) and the
    <a href="Stdlib.html#modules">standard library modules</a>.</p>
</div>
</div>
<hr width="100%">
<h2 id="1_Exceptions">Exceptions</h2>
<pre><span id="VALraise"><span class="keyword">val</span> raise</span> : <code class="type">exn -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise the given exception value</p>
</div>
</div>

<pre><span id="VALraise_notrace"><span class="keyword">val</span> raise_notrace</span> : <code class="type">exn -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>A faster version <code class="code">raise</code> which does not record the backtrace.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALinvalid_arg"><span class="keyword">val</span> invalid_arg</span> : <code class="type">string -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise exception <code class="code"><span class="constructor">Invalid_argument</span></code> with the given string.</p>
</div>
</div>

<pre><span id="VALfailwith"><span class="keyword">val</span> failwith</span> : <code class="type">string -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Raise exception <code class="code"><span class="constructor">Failure</span></code> with the given string.</p>
</div>
</div>

<pre><span id="EXCEPTIONExit"><span class="keyword">exception</span> Exit</span></pre>
<div class="info ">
<div class="info-desc">
<p>The <code class="code"><span class="constructor">Exit</span></code> exception is not raised by any library function.  It is
    provided for use in your programs.</p>
</div>
</div>

<pre><span id="EXCEPTIONMatch_failure"><span class="keyword">exception</span> Match_failure</span> <span class="keyword">of</span> <code class="type">(string * int * int)</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised when none of the cases of a pattern-matching
   apply. The arguments are the location of the match keyword in the
   source code (file name, line number, column number).</p>
</div>
</div>

<pre><span id="EXCEPTIONAssert_failure"><span class="keyword">exception</span> Assert_failure</span> <span class="keyword">of</span> <code class="type">(string * int * int)</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised when an assertion fails. The arguments are the
   location of the assert keyword in the source code (file name, line
   number, column number).</p>
</div>
</div>

<pre><span id="EXCEPTIONInvalid_argument"><span class="keyword">exception</span> Invalid_argument</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by library functions to signal that the given
   arguments do not make sense. The string gives some information to
   the programmer. As a general rule, this exception should not be
   caught, it denotes a programming error and the code should be
   modified not to trigger it.</p>
</div>
</div>

<pre><span id="EXCEPTIONFailure"><span class="keyword">exception</span> Failure</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by library functions to signal that they are
   undefined on the given arguments. The string is meant to give some
   information to the programmer; you must not pattern match on the
   string literal because it may change in future versions (use
   Failure _ instead).</p>
</div>
</div>

<pre><span id="EXCEPTIONNot_found"><span class="keyword">exception</span> Not_found</span></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by search functions when the desired object could
   not be found.</p>
</div>
</div>

<pre><span id="EXCEPTIONOut_of_memory"><span class="keyword">exception</span> Out_of_memory</span></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by the garbage collector when there is
   insufficient memory to complete the computation. (Not reliable for
   allocations on the minor heap.)</p>
</div>
</div>

<pre><span id="EXCEPTIONStack_overflow"><span class="keyword">exception</span> Stack_overflow</span></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by the bytecode interpreter when the evaluation
   stack reaches its maximal size. This often indicates infinite or
   excessively deep recursion in the user's program.</p>

<p>Before 4.10, it was not fully implemented by the native-code
   compiler.</p>
</div>
</div>

<pre><span id="EXCEPTIONSys_error"><span class="keyword">exception</span> Sys_error</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by the input/output functions to report an
   operating system error. The string is meant to give some
   information to the programmer; you must not pattern match on the
   string literal because it may change in future versions (use
   Sys_error _ instead).</p>
</div>
</div>

<pre><span id="EXCEPTIONEnd_of_file"><span class="keyword">exception</span> End_of_file</span></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by input functions to signal that the end of file
   has been reached.</p>
</div>
</div>

<pre><span id="EXCEPTIONDivision_by_zero"><span class="keyword">exception</span> Division_by_zero</span></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised by integer division and remainder operations when
   their second argument is zero.</p>
</div>
</div>

<pre><span id="EXCEPTIONSys_blocked_io"><span class="keyword">exception</span> Sys_blocked_io</span></pre>
<div class="info ">
<div class="info-desc">
<p>A special case of Sys_error raised when no I/O is possible on a
   non-blocking I/O channel.</p>
</div>
</div>

<pre><span id="EXCEPTIONUndefined_recursive_module"><span class="keyword">exception</span> Undefined_recursive_module</span> <span class="keyword">of</span> <code class="type">(string * int * int)</code></pre>
<div class="info ">
<div class="info-desc">
<p>Exception raised when an ill-founded recursive module definition
   is evaluated. The arguments are the location of the definition in
   the source code (file name, line number, column number).</p>
</div>
</div>
<h2 id="1_Comparisons">Comparisons</h2>
<pre><span id="VAL(=)"><span class="keyword">val</span> (=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">e1&nbsp;=&nbsp;e2</code> tests for structural equality of <code class="code">e1</code> and <code class="code">e2</code>.
   Mutable structures (e.g. references and arrays) are equal
   if and only if their current contents are structurally equal,
   even if the two mutable objects are not the same physical object.
   Equality between functional values raises <code class="code"><span class="constructor">Invalid_argument</span></code>.
   Equality between cyclic data structures may not terminate.
   Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(<>)"><span class="keyword">val</span> (&lt;&gt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Negation of <a href="Stdlib.html#VAL(=)"><code class="code">(=)</code></a>.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(<)"><span class="keyword">val</span> (&lt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Stdlib.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(>)"><span class="keyword">val</span> (&gt;)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Stdlib.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(<=)"><span class="keyword">val</span> (&lt;=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>See <a href="Stdlib.html#VAL(>=)"><code class="code">(&gt;=)</code></a>.
    Left-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(>=)"><span class="keyword">val</span> (&gt;=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Structural ordering functions. These functions coincide with
   the usual orderings over integers, characters, strings, byte sequences
   and floating-point numbers, and extend them to a
   total ordering over all types.
   The ordering is compatible with <code class="code">(&nbsp;=&nbsp;)</code>. As in the case
   of <code class="code">(&nbsp;=&nbsp;)</code>, mutable structures are compared by contents.
   Comparison between functional values raises <code class="code"><span class="constructor">Invalid_argument</span></code>.
   Comparison between cyclic structures may not terminate.
   Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type">'a -> 'a -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">compare&nbsp;x&nbsp;y</code> returns <code class="code">0</code> if <code class="code">x</code> is equal to <code class="code">y</code>,
   a negative integer if <code class="code">x</code> is less than <code class="code">y</code>, and a positive integer
   if <code class="code">x</code> is greater than <code class="code">y</code>.  The ordering implemented by <code class="code">compare</code>
   is compatible with the comparison predicates <code class="code">=</code>, <code class="code">&lt;</code> and <code class="code">&gt;</code>
   defined above,  with one difference on the treatment of the float value
   <a href="Stdlib.html#VALnan"><code class="code">nan</code></a>.  Namely, the comparison predicates treat <code class="code">nan</code>
   as different from any other float value, including itself;
   while <code class="code">compare</code> treats <code class="code">nan</code> as equal to itself and less than any
   other float value.  This treatment of <code class="code">nan</code> ensures that <code class="code">compare</code>
   defines a total ordering relation.</p>

<p><code class="code">compare</code> applied to functional values may raise <code class="code"><span class="constructor">Invalid_argument</span></code>.
   <code class="code">compare</code> applied to cyclic structures may not terminate.</p>

<p>The <code class="code">compare</code> function can be used as the comparison function
   required by the <a href="Set.Make.html"><code class="code"><span class="constructor">Set</span>.<span class="constructor">Make</span></code></a> and <a href="Map.Make.html"><code class="code"><span class="constructor">Map</span>.<span class="constructor">Make</span></code></a> functors, as well as
   the <a href="List.html#VALsort"><code class="code"><span class="constructor">List</span>.sort</code></a> and <a href="Array.html#VALsort"><code class="code"><span class="constructor">Array</span>.sort</code></a> functions.</p>
</div>
</div>

<pre><span id="VALmin"><span class="keyword">val</span> min</span> : <code class="type">'a -> 'a -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the smaller of the two arguments.
    The result is unspecified if one of the arguments contains
    the float value <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VALmax"><span class="keyword">val</span> max</span> : <code class="type">'a -> 'a -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the greater of the two arguments.
    The result is unspecified if one of the arguments contains
    the float value <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VAL(==)"><span class="keyword">val</span> (==)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">e1&nbsp;==&nbsp;e2</code> tests for physical equality of <code class="code">e1</code> and <code class="code">e2</code>.
   On mutable types such as references, arrays, byte sequences, records with
   mutable fields and objects with mutable instance variables,
   <code class="code">e1&nbsp;==&nbsp;e2</code> is true if and only if physical modification of <code class="code">e1</code>
   also affects <code class="code">e2</code>.
   On non-mutable types, the behavior of <code class="code">(&nbsp;==&nbsp;)</code> is
   implementation-dependent; however, it is guaranteed that
   <code class="code">e1&nbsp;==&nbsp;e2</code> implies <code class="code">compare&nbsp;e1&nbsp;e2&nbsp;=&nbsp;0</code>.
   Left-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(!=)"><span class="keyword">val</span> (!=)</span> : <code class="type">'a -> 'a -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Negation of <a href="Stdlib.html#VAL(==)"><code class="code">(==)</code></a>.
    Left-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>
<h2 id="1_Booleanoperations">Boolean operations</h2>
<pre><span id="VALnot"><span class="keyword">val</span> not</span> : <code class="type">bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean negation.</p>
</div>
</div>

<pre><span id="VAL(&&)"><span class="keyword">val</span> (&amp;&amp;)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean 'and'. Evaluation is sequential, left-to-right:
   in <code class="code">e1&nbsp;<span class="keywordsign">&amp;&amp;</span>&nbsp;e2</code>, <code class="code">e1</code> is evaluated first, and if it returns <code class="code"><span class="keyword">false</span></code>,
   <code class="code">e2</code> is not evaluated at all.
   Right-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(&)"><span class="keyword">val</span> (&amp;)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span><a href="Stdlib.html#VAL(&&)"><code class="code">(<span class="keywordsign">&amp;&amp;</span>)</code></a> should be used instead.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</div>
</div>

<pre><span id="VAL(||)"><span class="keyword">val</span> (||)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The boolean 'or'. Evaluation is sequential, left-to-right:
   in <code class="code">e1&nbsp;<span class="keywordsign">||</span>&nbsp;e2</code>, <code class="code">e1</code> is evaluated first, and if it returns <code class="code"><span class="keyword">true</span></code>,
   <code class="code">e2</code> is not evaluated at all.
   Right-associative operator,  see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(or)"><span class="keyword">val</span> (or)</span> : <code class="type">bool -> bool -> bool</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span><a href="Stdlib.html#VAL(||)"><code class="code">(<span class="keywordsign">||</span>)</code></a> should be used instead.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</div>
</div>
<h2 id="1_Debugging">Debugging</h2>
<pre><span id="VAL__LOC__"><span class="keyword">val</span> __LOC__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LOC__</code> returns the location at which this expression appears in
    the file currently being parsed by the compiler, with the standard
    error format of OCaml: "File %S, line %d, characters %d-%d".</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__FILE__"><span class="keyword">val</span> __FILE__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__FILE__</code> returns the name of the file currently being
    parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LINE__"><span class="keyword">val</span> __LINE__</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LINE__</code> returns the line number at which this expression
    appears in the file currently being parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__MODULE__"><span class="keyword">val</span> __MODULE__</span> : <code class="type">string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__MODULE__</code> returns the module name of the file being
    parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__POS__"><span class="keyword">val</span> __POS__</span> : <code class="type">string * int * int * int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__POS__</code> returns a tuple <code class="code">(file,lnum,cnum,enum)</code>, corresponding
    to the location at which this expression appears in the file
    currently being parsed by the compiler. <code class="code">file</code> is the current
    filename, <code class="code">lnum</code> the line number, <code class="code">cnum</code> the character position in
    the line and <code class="code">enum</code> the last character position in the line.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LOC_OF__"><span class="keyword">val</span> __LOC_OF__</span> : <code class="type">'a -> string * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LOC_OF__&nbsp;expr</code> returns a pair <code class="code">(loc,&nbsp;expr)</code> where <code class="code">loc</code> is the
    location of <code class="code">expr</code> in the file currently being parsed by the
    compiler, with the standard error format of OCaml: "File %S, line
    %d, characters %d-%d".</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__LINE_OF__"><span class="keyword">val</span> __LINE_OF__</span> : <code class="type">'a -> int * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__LINE_OF__&nbsp;expr</code> returns a pair <code class="code">(line,&nbsp;expr)</code>, where <code class="code">line</code> is the
    line number at which the expression <code class="code">expr</code> appears in the file
    currently being parsed by the compiler.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VAL__POS_OF__"><span class="keyword">val</span> __POS_OF__</span> : <code class="type">'a -> (string * int * int * int) * 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">__POS_OF__&nbsp;expr</code> returns a pair <code class="code">(loc,expr)</code>, where <code class="code">loc</code> is a
    tuple <code class="code">(file,lnum,cnum,enum)</code> corresponding to the location at
    which the expression <code class="code">expr</code> appears in the file currently being
    parsed by the compiler. <code class="code">file</code> is the current filename, <code class="code">lnum</code> the
    line number, <code class="code">cnum</code> the character position in the line and <code class="code">enum</code>
    the last character position in the line.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>
<h2 id="1_Compositionoperators">Composition operators</h2>
<pre><span id="VAL(|>)"><span class="keyword">val</span> (|&gt;)</span> : <code class="type">'a -> ('a -> 'b) -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Reverse-application operator: <code class="code">x&nbsp;|&gt;&nbsp;f&nbsp;|&gt;&nbsp;g</code> is exactly equivalent
 to <code class="code">g&nbsp;(f&nbsp;(x))</code>.
 Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01</li>
</ul>
</div>

<pre><span id="VAL(@@)"><span class="keyword">val</span> (@@)</span> : <code class="type">('a -> 'b) -> 'a -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Application operator: <code class="code">g&nbsp;@@&nbsp;f&nbsp;@@&nbsp;x</code> is exactly equivalent to
 <code class="code">g&nbsp;(f&nbsp;(x))</code>.
 Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01</li>
</ul>
</div>
<h2 id="1_Integerarithmetic">Integer arithmetic</h2><p>Integers are <code class="code"><span class="constructor">Sys</span>.int_size</code> bits wide.
    All operations are taken modulo 2<sup class="superscript"><code class="code"><span class="constructor">Sys</span>.int_size</code></sup>.
    They do not fail on overflow.</p>

<pre><span id="VAL(~-)"><span class="keyword">val</span> (~-)</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Unary negation. You can also write <code class="code">-&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~-</span>&nbsp;e</code>.
    Unary operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(~+)"><span class="keyword">val</span> (~+)</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Unary addition. You can also write <code class="code">+&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~+</span>&nbsp;e</code>.
    Unary operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALsucc"><span class="keyword">val</span> succ</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">succ&nbsp;x</code> is <code class="code">x&nbsp;+&nbsp;1</code>.</p>
</div>
</div>

<pre><span id="VALpred"><span class="keyword">val</span> pred</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pred&nbsp;x</code> is <code class="code">x&nbsp;-&nbsp;1</code>.</p>
</div>
</div>

<pre><span id="VAL(+)"><span class="keyword">val</span> (+)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer addition.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(-)"><span class="keyword">val</span> (-)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer subtraction.
    Left-associative operator, , see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL( * )"><span class="keyword">val</span> ( * )</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer multiplication.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(/)"><span class="keyword">val</span> (/)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer division.
   Integer division rounds the real quotient of its arguments towards zero.
   More precisely, if <code class="code">x&nbsp;&gt;=&nbsp;0</code> and <code class="code">y&nbsp;&gt;&nbsp;0</code>, <code class="code">x&nbsp;/&nbsp;y</code> is the greatest integer
   less than or equal to the real quotient of <code class="code">x</code> by <code class="code">y</code>.  Moreover,
   <code class="code">(-&nbsp;x)&nbsp;/&nbsp;y&nbsp;=&nbsp;x&nbsp;/&nbsp;(-&nbsp;y)&nbsp;=&nbsp;-&nbsp;(x&nbsp;/&nbsp;y)</code>.
   Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Division_by_zero</code> if the second argument is 0.</li>
</ul>
</div>

<pre><span id="VAL(mod)"><span class="keyword">val</span> (mod)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Integer remainder.  If <code class="code">y</code> is not zero, the result
   of <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> satisfies the following properties:
   <code class="code">x&nbsp;=&nbsp;(x&nbsp;/&nbsp;y)&nbsp;*&nbsp;y&nbsp;+&nbsp;x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> and
   <code class="code">abs(x&nbsp;<span class="keyword">mod</span>&nbsp;y)&nbsp;&lt;=&nbsp;abs(y)&nbsp;-&nbsp;1</code>.
   If <code class="code">y&nbsp;=&nbsp;0</code>, <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> raises <code class="code"><span class="constructor">Division_by_zero</span></code>.
   Note that <code class="code">x&nbsp;<span class="keyword">mod</span>&nbsp;y</code> is negative only if <code class="code">x&nbsp;&lt;&nbsp;0</code>.
   Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Division_by_zero</code> if <code class="code">y</code> is zero.</li>
</ul>
</div>

<pre><span id="VALabs"><span class="keyword">val</span> abs</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the absolute value of the argument.  Note that this may be
  negative if the argument is <code class="code">min_int</code>.</p>
</div>
</div>

<pre><span id="VALmax_int"><span class="keyword">val</span> max_int</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>The greatest representable integer.</p>
</div>
</div>

<pre><span id="VALmin_int"><span class="keyword">val</span> min_int</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>The smallest representable integer.</p>
</div>
</div>
<h3 id="2_Bitwiseoperations">Bitwise operations</h3>
<pre><span id="VAL(land)"><span class="keyword">val</span> (land)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical and.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(lor)"><span class="keyword">val</span> (lor)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical or.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(lxor)"><span class="keyword">val</span> (lxor)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical exclusive or.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VALlnot"><span class="keyword">val</span> lnot</span> : <code class="type">int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Bitwise logical negation.</p>
</div>
</div>

<pre><span id="VAL(lsl)"><span class="keyword">val</span> (lsl)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">lsl</span>&nbsp;m</code> shifts <code class="code">n</code> to the left by <code class="code">m</code> bits.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(lsr)"><span class="keyword">val</span> (lsr)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">lsr</span>&nbsp;m</code> shifts <code class="code">n</code> to the right by <code class="code">m</code> bits.
    This is a logical shift: zeroes are inserted regardless of
    the sign of <code class="code">n</code>.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(asr)"><span class="keyword">val</span> (asr)</span> : <code class="type">int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">n&nbsp;<span class="keyword">asr</span>&nbsp;m</code> shifts <code class="code">n</code> to the right by <code class="code">m</code> bits.
    This is an arithmetic shift: the sign bit of <code class="code">n</code> is replicated.
    The result is unspecified if <code class="code">m&nbsp;&lt;&nbsp;0</code> or <code class="code">m&nbsp;&gt;&nbsp;<span class="constructor">Sys</span>.int_size</code>.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>
<h2 id="1_Floatingpointarithmetic">Floating-point arithmetic</h2>
<p>OCaml's floating-point numbers follow the
   IEEE 754 standard, using double precision (64 bits) numbers.
   Floating-point operations never raise an exception on overflow,
   underflow, division by zero, etc.  Instead, special IEEE numbers
   are returned as appropriate, such as <code class="code">infinity</code> for <code class="code">1.0&nbsp;/.&nbsp;0.0</code>,
   <code class="code">neg_infinity</code> for <code class="code">-1.0&nbsp;/.&nbsp;0.0</code>, and <code class="code">nan</code> ('not a number')
   for <code class="code">0.0&nbsp;/.&nbsp;0.0</code>.  These special numbers then propagate through
   floating-point computations as expected: for instance,
   <code class="code">1.0&nbsp;/.&nbsp;infinity</code> is <code class="code">0.0</code>, and any arithmetic operation with <code class="code">nan</code>
   as argument returns <code class="code">nan</code> as result.</p>

<pre><span id="VAL(~-.)"><span class="keyword">val</span> (~-.)</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Unary negation. You can also write <code class="code">-.&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~-.</span>&nbsp;e</code>.
    Unary operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(~+.)"><span class="keyword">val</span> (~+.)</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Unary addition. You can also write <code class="code">+.&nbsp;e</code> instead of <code class="code"><span class="keywordsign">~+.</span>&nbsp;e</code>.
    Unary operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VAL(+.)"><span class="keyword">val</span> (+.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point addition.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(-.)"><span class="keyword">val</span> (-.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point subtraction.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL( *. )"><span class="keyword">val</span> ( *. )</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point multiplication.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(/.)"><span class="keyword">val</span> (/.)</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Floating-point division.
    Left-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL( ** )"><span class="keyword">val</span> ( ** )</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Exponentiation.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VALsqrt"><span class="keyword">val</span> sqrt</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Square root.</p>
</div>
</div>

<pre><span id="VALexp"><span class="keyword">val</span> exp</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Exponential.</p>
</div>
</div>

<pre><span id="VALlog"><span class="keyword">val</span> log</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Natural logarithm.</p>
</div>
</div>

<pre><span id="VALlog10"><span class="keyword">val</span> log10</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Base 10 logarithm.</p>
</div>
</div>

<pre><span id="VALexpm1"><span class="keyword">val</span> expm1</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">expm1&nbsp;x</code> computes <code class="code">exp&nbsp;x&nbsp;-.&nbsp;1.0</code>, giving numerically-accurate results
    even if <code class="code">x</code> is close to <code class="code">0.0</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALlog1p"><span class="keyword">val</span> log1p</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">log1p&nbsp;x</code> computes <code class="code">log(1.0&nbsp;+.&nbsp;x)</code> (natural logarithm),
    giving numerically-accurate results even if <code class="code">x</code> is close to <code class="code">0.0</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALcos"><span class="keyword">val</span> cos</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Cosine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALsin"><span class="keyword">val</span> sin</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Sine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALtan"><span class="keyword">val</span> tan</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Tangent.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALacos"><span class="keyword">val</span> acos</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc cosine.  The argument must fall within the range <code class="code">[-1.0,&nbsp;1.0]</code>.
    Result is in radians and is between <code class="code">0.0</code> and <code class="code">pi</code>.</p>
</div>
</div>

<pre><span id="VALasin"><span class="keyword">val</span> asin</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc sine.  The argument must fall within the range <code class="code">[-1.0,&nbsp;1.0]</code>.
    Result is in radians and is between <code class="code">-pi/2</code> and <code class="code">pi/2</code>.</p>
</div>
</div>

<pre><span id="VALatan"><span class="keyword">val</span> atan</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Arc tangent.
    Result is in radians and is between <code class="code">-pi/2</code> and <code class="code">pi/2</code>.</p>
</div>
</div>

<pre><span id="VALatan2"><span class="keyword">val</span> atan2</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">atan2&nbsp;y&nbsp;x</code> returns the arc tangent of <code class="code">y&nbsp;/.&nbsp;x</code>.  The signs of <code class="code">x</code>
    and <code class="code">y</code> are used to determine the quadrant of the result.
    Result is in radians and is between <code class="code">-pi</code> and <code class="code">pi</code>.</p>
</div>
</div>

<pre><span id="VALhypot"><span class="keyword">val</span> hypot</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">hypot&nbsp;x&nbsp;y</code> returns <code class="code">sqrt(x&nbsp;*.&nbsp;x&nbsp;+&nbsp;y&nbsp;*.&nbsp;y)</code>, that is, the length
  of the hypotenuse of a right-angled triangle with sides of length
  <code class="code">x</code> and <code class="code">y</code>, or, equivalently, the distance of the point <code class="code">(x,y)</code>
  to origin.  If one of <code class="code">x</code> or <code class="code">y</code> is infinite, returns <code class="code">infinity</code>
  even if the other is <code class="code">nan</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.00.0</li>
</ul>
</div>

<pre><span id="VALcosh"><span class="keyword">val</span> cosh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic cosine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALsinh"><span class="keyword">val</span> sinh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic sine.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALtanh"><span class="keyword">val</span> tanh</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Hyperbolic tangent.  Argument is in radians.</p>
</div>
</div>

<pre><span id="VALceil"><span class="keyword">val</span> ceil</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Round above to an integer value.
    <code class="code">ceil&nbsp;f</code> returns the least integer value greater than or equal to <code class="code">f</code>.
    The result is returned as a float.</p>
</div>
</div>

<pre><span id="VALfloor"><span class="keyword">val</span> floor</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Round below to an integer value.
    <code class="code">floor&nbsp;f</code> returns the greatest integer value less than or
    equal to <code class="code">f</code>.
    The result is returned as a float.</p>
</div>
</div>

<pre><span id="VALabs_float"><span class="keyword">val</span> abs_float</span> : <code class="type">float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">abs_float&nbsp;f</code> returns the absolute value of <code class="code">f</code>.</p>
</div>
</div>

<pre><span id="VALcopysign"><span class="keyword">val</span> copysign</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">copysign&nbsp;x&nbsp;y</code> returns a float whose absolute value is that of <code class="code">x</code>
  and whose sign is that of <code class="code">y</code>.  If <code class="code">x</code> is <code class="code">nan</code>, returns <code class="code">nan</code>.
  If <code class="code">y</code> is <code class="code">nan</code>, returns either <code class="code">x</code> or <code class="code">-.&nbsp;x</code>, but it is not
  specified which.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.00.0</li>
</ul>
</div>

<pre><span id="VALmod_float"><span class="keyword">val</span> mod_float</span> : <code class="type">float -> float -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">mod_float&nbsp;a&nbsp;b</code> returns the remainder of <code class="code">a</code> with respect to
   <code class="code">b</code>.  The returned value is <code class="code">a&nbsp;-.&nbsp;n&nbsp;*.&nbsp;b</code>, where <code class="code">n</code>
   is the quotient <code class="code">a&nbsp;/.&nbsp;b</code> rounded towards zero to an integer.</p>
</div>
</div>

<pre><span id="VALfrexp"><span class="keyword">val</span> frexp</span> : <code class="type">float -> float * int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">frexp&nbsp;f</code> returns the pair of the significant
   and the exponent of <code class="code">f</code>.  When <code class="code">f</code> is zero, the
   significant <code class="code">x</code> and the exponent <code class="code">n</code> of <code class="code">f</code> are equal to
   zero.  When <code class="code">f</code> is non-zero, they are defined by
   <code class="code">f&nbsp;=&nbsp;x&nbsp;*.&nbsp;2&nbsp;**&nbsp;n</code> and <code class="code">0.5&nbsp;&lt;=&nbsp;x&nbsp;&lt;&nbsp;1.0</code>.</p>
</div>
</div>

<pre><span id="VALldexp"><span class="keyword">val</span> ldexp</span> : <code class="type">float -> int -> float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">ldexp&nbsp;x&nbsp;n</code> returns <code class="code">x&nbsp;*.&nbsp;2&nbsp;**&nbsp;n</code>.</p>
</div>
</div>

<pre><span id="VALmodf"><span class="keyword">val</span> modf</span> : <code class="type">float -> float * float</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">modf&nbsp;f</code> returns the pair of the fractional and integral
   part of <code class="code">f</code>.</p>
</div>
</div>

<pre><span id="VALfloat"><span class="keyword">val</span> float</span> : <code class="type">int -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALfloat_of_int"><code class="code">float_of_int</code></a>.</p>
</div>
</div>

<pre><span id="VALfloat_of_int"><span class="keyword">val</span> float_of_int</span> : <code class="type">int -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Convert an integer to floating-point.</p>
</div>
</div>

<pre><span id="VALtruncate"><span class="keyword">val</span> truncate</span> : <code class="type">float -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALint_of_float"><code class="code">int_of_float</code></a>.</p>
</div>
</div>

<pre><span id="VALint_of_float"><span class="keyword">val</span> int_of_float</span> : <code class="type">float -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Truncate the given floating-point number to an integer.
   The result is unspecified if the argument is <code class="code">nan</code> or falls outside the
   range of representable integers.</p>
</div>
</div>

<pre><span id="VALinfinity"><span class="keyword">val</span> infinity</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>Positive infinity.</p>
</div>
</div>

<pre><span id="VALneg_infinity"><span class="keyword">val</span> neg_infinity</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>Negative infinity.</p>
</div>
</div>

<pre><span id="VALnan"><span class="keyword">val</span> nan</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>A special floating-point value denoting the result of an
   undefined operation such as <code class="code">0.0&nbsp;/.&nbsp;0.0</code>.  Stands for
   'not a number'.  Any floating-point operation with <code class="code">nan</code> as
   argument returns <code class="code">nan</code> as result.  As for floating-point comparisons,
   <code class="code">=</code>, <code class="code">&lt;</code>, <code class="code">&lt;=</code>, <code class="code">&gt;</code> and <code class="code">&gt;=</code> return <code class="code"><span class="keyword">false</span></code> and <code class="code">&lt;&gt;</code> returns <code class="code"><span class="keyword">true</span></code>
   if one or both of their arguments is <code class="code">nan</code>.</p>
</div>
</div>

<pre><span id="VALmax_float"><span class="keyword">val</span> max_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The largest positive finite value of type <code class="code">float</code>.</p>
</div>
</div>

<pre><span id="VALmin_float"><span class="keyword">val</span> min_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The smallest positive, non-zero, non-denormalized value of type <code class="code">float</code>.</p>
</div>
</div>

<pre><span id="VALepsilon_float"><span class="keyword">val</span> epsilon_float</span> : <code class="type">float</code></pre><div class="info ">
<div class="info-desc">
<p>The difference between <code class="code">1.0</code> and the smallest exactly representable
    floating-point number greater than <code class="code">1.0</code>.</p>
</div>
</div>

<pre><code><span id="TYPEfpclass"><span class="keyword">type</span> <code class="type"></code>fpclass</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_normal"><span class="constructor">FP_normal</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Normal number, none of the below</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_subnormal"><span class="constructor">FP_subnormal</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number very close to 0.0, has reduced precision</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_zero"><span class="constructor">FP_zero</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number is 0.0 or -0.0</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_infinite"><span class="constructor">FP_infinite</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Number is positive or negative infinity</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfpclass.FP_nan"><span class="constructor">FP_nan</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Not a number: result of an undefined operation</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>The five classes of floating-point numbers, as determined by
   the <a href="Stdlib.html#VALclassify_float"><code class="code">classify_float</code></a> function.</p>
</div>
</div>


<pre><span id="VALclassify_float"><span class="keyword">val</span> classify_float</span> : <code class="type">float -> <a href="Stdlib.html#TYPEfpclass">fpclass</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return the class of the given floating-point number:
   normal, subnormal, zero, infinite, or not a number.</p>
</div>
</div>
<h2 id="1_Stringoperations">String operations</h2>
<p>More string operations are provided in module <a href="String.html"><code class="code"><span class="constructor">String</span></code></a>.</p>

<pre><span id="VAL(^)"><span class="keyword">val</span> (^)</span> : <code class="type">string -> string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>String concatenation.
    Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>
<h2 id="1_Characteroperations">Character operations</h2>
<p>More character operations are provided in module <a href="Char.html"><code class="code"><span class="constructor">Char</span></code></a>.</p>

<pre><span id="VALint_of_char"><span class="keyword">val</span> int_of_char</span> : <code class="type">char -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the ASCII code of the argument.</p>
</div>
</div>

<pre><span id="VALchar_of_int"><span class="keyword">val</span> char_of_int</span> : <code class="type">int -> char</code></pre><div class="info ">
<div class="info-desc">
<p>Return the character with the given ASCII code.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if the argument is
   outside the range 0--255.</li>
</ul>
</div>
<h2 id="1_Unitoperations">Unit operations</h2>
<pre><span id="VALignore"><span class="keyword">val</span> ignore</span> : <code class="type">'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Discard the value of its argument and return <code class="code">()</code>.
   For instance, <code class="code">ignore(f&nbsp;x)</code> discards the result of
   the side-effecting function <code class="code">f</code>.  It is equivalent to
   <code class="code">f&nbsp;x;&nbsp;()</code>, except that the latter may generate a
   compiler warning; writing <code class="code">ignore(f&nbsp;x)</code> instead
   avoids the warning.</p>
</div>
</div>
<h2 id="1_Stringconversionfunctions">String conversion functions</h2>
<pre><span id="VALstring_of_bool"><span class="keyword">val</span> string_of_bool</span> : <code class="type">bool -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the string representation of a boolean. As the returned values
   may be shared, the user should not modify them directly.</p>
</div>
</div>

<pre><span id="VALbool_of_string_opt"><span class="keyword">val</span> bool_of_string_opt</span> : <code class="type">string -> bool option</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to a boolean.</p>

<p>Return <code class="code"><span class="constructor">None</span></code> if the string is not <code class="code"><span class="string">"true"</span></code> or <code class="code"><span class="string">"false"</span></code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALbool_of_string"><span class="keyword">val</span> bool_of_string</span> : <code class="type">string -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALbool_of_string_opt"><code class="code">bool_of_string_opt</code></a>, but raise
   <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"bool_of_string"</span></code> instead of returning <code class="code"><span class="constructor">None</span></code>.</p>
</div>
</div>

<pre><span id="VALstring_of_int"><span class="keyword">val</span> string_of_int</span> : <code class="type">int -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the string representation of an integer, in decimal.</p>
</div>
</div>

<pre><span id="VALint_of_string_opt"><span class="keyword">val</span> int_of_string_opt</span> : <code class="type">string -> int option</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to an integer.
   The string is read in decimal (by default, or if the string
   begins with <code class="code">0u</code>), in hexadecimal (if it begins with <code class="code">0x</code> or
   <code class="code">0<span class="constructor">X</span></code>), in octal (if it begins with <code class="code">0o</code> or <code class="code">0<span class="constructor">O</span></code>), or in binary
   (if it begins with <code class="code">0b</code> or <code class="code">0<span class="constructor">B</span></code>).</p>

<p>The <code class="code">0u</code> prefix reads the input as an unsigned integer in the range
   <code class="code">[0,&nbsp;2*max_int+1]</code>.  If the input exceeds <a href="Stdlib.html#VALmax_int"><code class="code">max_int</code></a>
   it is converted to the signed integer
   <code class="code">min_int&nbsp;+&nbsp;input&nbsp;-&nbsp;max_int&nbsp;-&nbsp;1</code>.</p>

<p>The <code class="code">_</code> (underscore) character can appear anywhere in the string
   and is ignored.</p>

<p>Return <code class="code"><span class="constructor">None</span></code> if the given string is not a valid representation of an
   integer, or if the integer represented exceeds the range of integers
   representable in type <code class="code">int</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALint_of_string"><span class="keyword">val</span> int_of_string</span> : <code class="type">string -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALint_of_string_opt"><code class="code">int_of_string_opt</code></a>, but raise
   <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"int_of_string"</span></code> instead of returning <code class="code"><span class="constructor">None</span></code>.</p>
</div>
</div>

<pre><span id="VALstring_of_float"><span class="keyword">val</span> string_of_float</span> : <code class="type">float -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the string representation of a floating-point number.</p>
</div>
</div>

<pre><span id="VALfloat_of_string_opt"><span class="keyword">val</span> float_of_string_opt</span> : <code class="type">string -> float option</code></pre><div class="info ">
<div class="info-desc">
<p>Convert the given string to a float.  The string is read in decimal
   (by default) or in hexadecimal (marked by <code class="code">0x</code> or <code class="code">0<span class="constructor">X</span></code>).</p>

<p>The format of decimal floating-point numbers is
   <code class="code">&nbsp;[-]&nbsp;dd.ddd&nbsp;(e<span class="keywordsign">|</span><span class="constructor">E</span>)&nbsp;[+|-]&nbsp;dd&nbsp;</code>, where <code class="code">d</code> stands for a decimal digit.</p>

<p>The format of hexadecimal floating-point numbers is
   <code class="code">&nbsp;[-]&nbsp;0(x<span class="keywordsign">|</span><span class="constructor">X</span>)&nbsp;hh.hhh&nbsp;(p<span class="keywordsign">|</span><span class="constructor">P</span>)&nbsp;[+|-]&nbsp;dd&nbsp;</code>, where <code class="code">h</code> stands for an
   hexadecimal digit and <code class="code">d</code> for a decimal digit.</p>

<p>In both cases, at least one of the integer and fractional parts must be
   given; the exponent part is optional.</p>

<p>The <code class="code">_</code> (underscore) character can appear anywhere in the string
   and is ignored.</p>

<p>Depending on the execution platforms, other representations of
   floating-point numbers can be accepted, but should not be relied upon.</p>

<p>Return <code class="code"><span class="constructor">None</span></code> if the given string is not a valid representation of a float.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALfloat_of_string"><span class="keyword">val</span> float_of_string</span> : <code class="type">string -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALfloat_of_string_opt"><code class="code">float_of_string_opt</code></a>, but raise
   <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"float_of_string"</span></code> instead of returning <code class="code"><span class="constructor">None</span></code>.</p>
</div>
</div>
<h2 id="1_Pairoperations">Pair operations</h2>
<pre><span id="VALfst"><span class="keyword">val</span> fst</span> : <code class="type">'a * 'b -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Return the first component of a pair.</p>
</div>
</div>

<pre><span id="VALsnd"><span class="keyword">val</span> snd</span> : <code class="type">'a * 'b -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Return the second component of a pair.</p>
</div>
</div>
<h2 id="1_Listoperations">List operations</h2>
<p>More list operations are provided in module <a href="List.html"><code class="code"><span class="constructor">List</span></code></a>.</p>

<pre><span id="VAL(@)"><span class="keyword">val</span> (@)</span> : <code class="type">'a list -> 'a list -> 'a list</code></pre><div class="info ">
<div class="info-desc">
<p>List concatenation.  Not tail-recursive (length of the first argument).
  Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>
<h2 id="1_Inputoutput">Input/output</h2><p>Note: all input/output functions can raise <code class="code"><span class="constructor">Sys_error</span></code> when the system
    calls they invoke fail.</p>

<pre><span id="TYPEin_channel"><span class="keyword">type</span> <code class="type"></code>in_channel</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of input channel.</p>
</div>
</div>


<pre><span id="TYPEout_channel"><span class="keyword">type</span> <code class="type"></code>out_channel</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The type of output channel.</p>
</div>
</div>


<pre><span id="VALstdin"><span class="keyword">val</span> stdin</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard input for the process.</p>
</div>
</div>

<pre><span id="VALstdout"><span class="keyword">val</span> stdout</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard output for the process.</p>
</div>
</div>

<pre><span id="VALstderr"><span class="keyword">val</span> stderr</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard error output for the process.</p>
</div>
</div>
<h3 id="2_Outputfunctionsonstandardoutput">Output functions on standard output</h3>
<pre><span id="VALprint_char"><span class="keyword">val</span> print_char</span> : <code class="type">char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a character on standard output.</p>
</div>
</div>

<pre><span id="VALprint_string"><span class="keyword">val</span> print_string</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string on standard output.</p>
</div>
</div>

<pre><span id="VALprint_bytes"><span class="keyword">val</span> print_bytes</span> : <code class="type">bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a byte sequence on standard output.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALprint_int"><span class="keyword">val</span> print_int</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print an integer, in decimal, on standard output.</p>
</div>
</div>

<pre><span id="VALprint_float"><span class="keyword">val</span> print_float</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a floating-point number, in decimal, on standard output.</p>
</div>
</div>

<pre><span id="VALprint_endline"><span class="keyword">val</span> print_endline</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string, followed by a newline character, on
   standard output and flush standard output.</p>
</div>
</div>

<pre><span id="VALprint_newline"><span class="keyword">val</span> print_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a newline character on standard output, and flush
   standard output. This can be used to simulate line
   buffering of standard output.</p>
</div>
</div>
<h3 id="2_Outputfunctionsonstandarderror">Output functions on standard error</h3>
<pre><span id="VALprerr_char"><span class="keyword">val</span> prerr_char</span> : <code class="type">char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a character on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_string"><span class="keyword">val</span> prerr_string</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_bytes"><span class="keyword">val</span> prerr_bytes</span> : <code class="type">bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a byte sequence on standard error.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALprerr_int"><span class="keyword">val</span> prerr_int</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print an integer, in decimal, on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_float"><span class="keyword">val</span> prerr_float</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a floating-point number, in decimal, on standard error.</p>
</div>
</div>

<pre><span id="VALprerr_endline"><span class="keyword">val</span> prerr_endline</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a string, followed by a newline character on standard
   error and flush standard error.</p>
</div>
</div>

<pre><span id="VALprerr_newline"><span class="keyword">val</span> prerr_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a newline character on standard error, and flush
   standard error.</p>
</div>
</div>
<h3 id="2_Inputfunctionsonstandardinput">Input functions on standard input</h3>
<pre><span id="VALread_line"><span class="keyword">val</span> read_line</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read characters from standard input
   until a newline character is encountered. Return the string of
   all characters read, without the newline character at the end.</p>
</div>
</div>

<pre><span id="VALread_int_opt"><span class="keyword">val</span> read_int_opt</span> : <code class="type">unit -> int option</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read one line from standard input
   and convert it to an integer.</p>

<p>Return <code class="code"><span class="constructor">None</span></code> if the line read is not a valid representation of an integer.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>

<pre><span id="VALread_int"><span class="keyword">val</span> read_int</span> : <code class="type">unit -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALread_int_opt"><code class="code">read_int_opt</code></a>, but raise <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"int_of_string"</span></code>
   instead of returning <code class="code"><span class="constructor">None</span></code>.</p>
</div>
</div>

<pre><span id="VALread_float_opt"><span class="keyword">val</span> read_float_opt</span> : <code class="type">unit -> float option</code></pre><div class="info ">
<div class="info-desc">
<p>Flush standard output, then read one line from standard input
   and convert it to a floating-point number.</p>

<p>Return <code class="code"><span class="constructor">None</span></code> if the line read is not a valid representation of a
   floating-point number.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="VALread_float"><span class="keyword">val</span> read_float</span> : <code class="type">unit -> float</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALread_float_opt"><code class="code">read_float_opt</code></a>, but raise <code class="code"><span class="constructor">Failure</span>&nbsp;<span class="string">"float_of_string"</span></code>
   instead of returning <code class="code"><span class="constructor">None</span></code>.</p>
</div>
</div>
<h3 id="2_Generaloutputfunctions">General output functions</h3>
<pre><code><span id="TYPEopen_flag"><span class="keyword">type</span> <code class="type"></code>open_flag</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_rdonly"><span class="constructor">Open_rdonly</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for reading.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_wronly"><span class="constructor">Open_wronly</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for writing.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_append"><span class="constructor">Open_append</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open for appending: always write at end of file.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_creat"><span class="constructor">Open_creat</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>create the file if it does not exist.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_trunc"><span class="constructor">Open_trunc</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>empty the file if it already exists.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_excl"><span class="constructor">Open_excl</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>fail if Open_creat and the file already exists.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_binary"><span class="constructor">Open_binary</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in binary mode (no conversion).</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_text"><span class="constructor">Open_text</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in text mode (may perform conversions).</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTopen_flag.Open_nonblock"><span class="constructor">Open_nonblock</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>open in non-blocking mode.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Opening modes for <a href="Stdlib.html#VALopen_out_gen"><code class="code">open_out_gen</code></a> and
  <a href="Stdlib.html#VALopen_in_gen"><code class="code">open_in_gen</code></a>.</p>
</div>
</div>


<pre><span id="VALopen_out"><span class="keyword">val</span> open_out</span> : <code class="type">string -> <a href="Stdlib.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Open the named file for writing, and return a new output channel
   on that file, positioned at the beginning of the file. The
   file is truncated to zero length if it already exists. It
   is created if it does not already exists.</p>
</div>
</div>

<pre><span id="VALopen_out_bin"><span class="keyword">val</span> open_out_bin</span> : <code class="type">string -> <a href="Stdlib.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALopen_out"><code class="code">open_out</code></a>, but the file is opened in binary mode,
   so that no translation takes place during writes. On operating
   systems that do not distinguish between text mode and binary
   mode, this function behaves like <a href="Stdlib.html#VALopen_out"><code class="code">open_out</code></a>.</p>
</div>
</div>

<pre><span id="VALopen_out_gen"><span class="keyword">val</span> open_out_gen</span> : <code class="type"><a href="Stdlib.html#TYPEopen_flag">open_flag</a> list -> int -> string -> <a href="Stdlib.html#TYPEout_channel">out_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">open_out_gen&nbsp;mode&nbsp;perm&nbsp;filename</code> opens the named file for writing,
   as described above. The extra argument <code class="code">mode</code>
   specifies the opening mode. The extra argument <code class="code">perm</code> specifies
   the file permissions, in case the file must be created.
   <a href="Stdlib.html#VALopen_out"><code class="code">open_out</code></a> and <a href="Stdlib.html#VALopen_out_bin"><code class="code">open_out_bin</code></a> are special
   cases of this function.</p>
</div>
</div>

<pre><span id="VALflush"><span class="keyword">val</span> flush</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Flush the buffer associated with the given output channel,
   performing all pending writes on that channel.
   Interactive programs must be careful about flushing standard
   output and standard error at the right time.</p>
</div>
</div>

<pre><span id="VALflush_all"><span class="keyword">val</span> flush_all</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Flush all open output channels; ignore errors.</p>
</div>
</div>

<pre><span id="VALoutput_char"><span class="keyword">val</span> output_char</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the character on the given output channel.</p>
</div>
</div>

<pre><span id="VALoutput_string"><span class="keyword">val</span> output_string</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the string on the given output channel.</p>
</div>
</div>

<pre><span id="VALoutput_bytes"><span class="keyword">val</span> output_bytes</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the byte sequence on the given output channel.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALoutput"><span class="keyword">val</span> output</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">output&nbsp;oc&nbsp;buf&nbsp;pos&nbsp;len</code> writes <code class="code">len</code> characters from byte sequence <code class="code">buf</code>,
   starting at offset <code class="code">pos</code>, to the given output channel <code class="code">oc</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">pos</code> and <code class="code">len</code> do not
   designate a valid range of <code class="code">buf</code>.</li>
</ul>
</div>

<pre><span id="VALoutput_substring"><span class="keyword">val</span> output_substring</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> string -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">output</code> but take a string as argument instead of
   a byte sequence.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALoutput_byte"><span class="keyword">val</span> output_byte</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write one 8-bit integer (as the single character with that code)
   on the given output channel. The given integer is taken modulo
   256.</p>
</div>
</div>

<pre><span id="VALoutput_binary_int"><span class="keyword">val</span> output_binary_int</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write one integer in binary format (4 bytes, big-endian)
   on the given output channel.
   The given integer is taken modulo 2<sup class="superscript">32</sup>.
   The only reliable way to read it back is through the
   <a href="Stdlib.html#VALinput_binary_int"><code class="code">input_binary_int</code></a> function. The format is compatible across
   all machines for a given version of OCaml.</p>
</div>
</div>

<pre><span id="VALoutput_value"><span class="keyword">val</span> output_value</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> 'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Write the representation of a structured value of any type
   to a channel. Circularities and sharing inside the value
   are detected and preserved. The object can be read back,
   by the function <a href="Stdlib.html#VALinput_value"><code class="code">input_value</code></a>. See the description of module
   <a href="Marshal.html"><code class="code"><span class="constructor">Marshal</span></code></a> for more information. <a href="Stdlib.html#VALoutput_value"><code class="code">output_value</code></a> is equivalent
   to <a href="Marshal.html#VALto_channel"><code class="code"><span class="constructor">Marshal</span>.to_channel</code></a> with an empty list of flags.</p>
</div>
</div>

<pre><span id="VALseek_out"><span class="keyword">val</span> seek_out</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">seek_out&nbsp;chan&nbsp;pos</code> sets the current writing position to <code class="code">pos</code>
   for channel <code class="code">chan</code>. This works only for regular files. On
   files of other kinds (such as terminals, pipes and sockets),
   the behavior is unspecified.</p>
</div>
</div>

<pre><span id="VALpos_out"><span class="keyword">val</span> pos_out</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current writing position for the given channel.  Does
    not work on channels opened with the <code class="code"><span class="constructor">Open_append</span></code> flag (returns
    unspecified results).</p>
</div>
</div>

<pre><span id="VALout_channel_length"><span class="keyword">val</span> out_channel_length</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the size (number of characters) of the regular file
   on which the given channel is opened.  If the channel is opened
    on a file that is not a regular file, the result is meaningless.</p>
</div>
</div>

<pre><span id="VALclose_out"><span class="keyword">val</span> close_out</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Close the given channel, flushing all buffered write operations.
   Output functions raise a <code class="code"><span class="constructor">Sys_error</span></code> exception when they are
   applied to a closed output channel, except <code class="code">close_out</code> and <code class="code">flush</code>,
   which do nothing when applied to an already closed channel.
   Note that <code class="code">close_out</code> may raise <code class="code"><span class="constructor">Sys_error</span></code> if the operating
   system signals an error when flushing or closing.</p>
</div>
</div>

<pre><span id="VALclose_out_noerr"><span class="keyword">val</span> close_out_noerr</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">close_out</code>, but ignore all errors.</p>
</div>
</div>

<pre><span id="VALset_binary_mode_out"><span class="keyword">val</span> set_binary_mode_out</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_binary_mode_out&nbsp;oc&nbsp;<span class="keyword">true</span></code> sets the channel <code class="code">oc</code> to binary
   mode: no translations take place during output.
   <code class="code">set_binary_mode_out&nbsp;oc&nbsp;<span class="keyword">false</span></code> sets the channel <code class="code">oc</code> to text
   mode: depending on the operating system, some translations
   may take place during output.  For instance, under Windows,
   end-of-lines will be translated from <code class="code">\n</code> to <code class="code">\r\n</code>.
   This function has no effect under operating systems that
   do not distinguish between text mode and binary mode.</p>
</div>
</div>
<h3 id="2_Generalinputfunctions">General input functions</h3>
<pre><span id="VALopen_in"><span class="keyword">val</span> open_in</span> : <code class="type">string -> <a href="Stdlib.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Open the named file for reading, and return a new input channel
   on that file, positioned at the beginning of the file.</p>
</div>
</div>

<pre><span id="VALopen_in_bin"><span class="keyword">val</span> open_in_bin</span> : <code class="type">string -> <a href="Stdlib.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALopen_in"><code class="code">open_in</code></a>, but the file is opened in binary mode,
   so that no translation takes place during reads. On operating
   systems that do not distinguish between text mode and binary
   mode, this function behaves like <a href="Stdlib.html#VALopen_in"><code class="code">open_in</code></a>.</p>
</div>
</div>

<pre><span id="VALopen_in_gen"><span class="keyword">val</span> open_in_gen</span> : <code class="type"><a href="Stdlib.html#TYPEopen_flag">open_flag</a> list -> int -> string -> <a href="Stdlib.html#TYPEin_channel">in_channel</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">open_in_gen&nbsp;mode&nbsp;perm&nbsp;filename</code> opens the named file for reading,
   as described above. The extra arguments
   <code class="code">mode</code> and <code class="code">perm</code> specify the opening mode and file permissions.
   <a href="Stdlib.html#VALopen_in"><code class="code">open_in</code></a> and <a href="Stdlib.html#VALopen_in_bin"><code class="code">open_in_bin</code></a> are special
   cases of this function.</p>
</div>
</div>

<pre><span id="VALinput_char"><span class="keyword">val</span> input_char</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> char</code></pre><div class="info ">
<div class="info-desc">
<p>Read one character from the given input channel.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>End_of_file</code> if there are no more characters to read.</li>
</ul>
</div>

<pre><span id="VALinput_line"><span class="keyword">val</span> input_line</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Read characters from the given input channel, until a
   newline character is encountered. Return the string of
   all characters read, without the newline character at the end.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>End_of_file</code> if the end of the file is reached
   at the beginning of line.</li>
</ul>
</div>

<pre><span id="VALinput"><span class="keyword">val</span> input</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> bytes -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">input&nbsp;ic&nbsp;buf&nbsp;pos&nbsp;len</code> reads up to <code class="code">len</code> characters from
   the given channel <code class="code">ic</code>, storing them in byte sequence <code class="code">buf</code>, starting at
   character number <code class="code">pos</code>.
   It returns the actual number of characters read, between 0 and
   <code class="code">len</code> (inclusive).
   A return value of 0 means that the end of file was reached.
   A return value between 0 and <code class="code">len</code> exclusive means that
   not all requested <code class="code">len</code> characters were read, either because
   no more characters were available at that time, or because
   the implementation found it convenient to do a partial read;
   <code class="code">input</code> must be called again to read the remaining characters,
   if desired.  (See also <a href="Stdlib.html#VALreally_input"><code class="code">really_input</code></a> for reading
   exactly <code class="code">len</code> characters.)
   Exception <code class="code"><span class="constructor">Invalid_argument</span>&nbsp;<span class="string">"input"</span></code> is raised if <code class="code">pos</code> and <code class="code">len</code>
   do not designate a valid range of <code class="code">buf</code>.</p>
</div>
</div>

<pre><span id="VALreally_input"><span class="keyword">val</span> really_input</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_input&nbsp;ic&nbsp;buf&nbsp;pos&nbsp;len</code> reads <code class="code">len</code> characters from channel <code class="code">ic</code>,
   storing them in byte sequence <code class="code">buf</code>, starting at character number <code class="code">pos</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b><ul><li><code>End_of_file</code> if the end of file is reached before <code class="code">len</code>
   characters have been read.</li>
<li><code>Invalid_argument</code> if
   <code class="code">pos</code> and <code class="code">len</code> do not designate a valid range of <code class="code">buf</code>.</li>
</ul></li>
</ul>
</div>

<pre><span id="VALreally_input_string"><span class="keyword">val</span> really_input_string</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int -> string</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_input_string&nbsp;ic&nbsp;len</code> reads <code class="code">len</code> characters from channel <code class="code">ic</code>
   and returns them in a new string.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
<li><b>Raises</b> <code>End_of_file</code> if the end of file is reached before <code class="code">len</code>
   characters have been read.</li>
</ul>
</div>

<pre><span id="VALinput_byte"><span class="keyword">val</span> input_byte</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Stdlib.html#VALinput_char"><code class="code">input_char</code></a>, but return the 8-bit integer representing
   the character.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>End_of_file</code> if an end of file was reached.</li>
</ul>
</div>

<pre><span id="VALinput_binary_int"><span class="keyword">val</span> input_binary_int</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Read an integer encoded in binary format (4 bytes, big-endian)
   from the given input channel. See <a href="Stdlib.html#VALoutput_binary_int"><code class="code">output_binary_int</code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>End_of_file</code> if an end of file was reached while reading the
   integer.</li>
</ul>
</div>

<pre><span id="VALinput_value"><span class="keyword">val</span> input_value</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Read the representation of a structured value, as produced
   by <a href="Stdlib.html#VALoutput_value"><code class="code">output_value</code></a>, and return the corresponding value.
   This function is identical to <a href="Marshal.html#VALfrom_channel"><code class="code"><span class="constructor">Marshal</span>.from_channel</code></a>;
   see the description of module <a href="Marshal.html"><code class="code"><span class="constructor">Marshal</span></code></a> for more information,
   in particular concerning the lack of type safety.</p>
</div>
</div>

<pre><span id="VALseek_in"><span class="keyword">val</span> seek_in</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">seek_in&nbsp;chan&nbsp;pos</code> sets the current reading position to <code class="code">pos</code>
   for channel <code class="code">chan</code>. This works only for regular files. On
   files of other kinds, the behavior is unspecified.</p>
</div>
</div>

<pre><span id="VALpos_in"><span class="keyword">val</span> pos_in</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current reading position for the given channel.</p>
</div>
</div>

<pre><span id="VALin_channel_length"><span class="keyword">val</span> in_channel_length</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the size (number of characters) of the regular file
    on which the given channel is opened.  If the channel is opened
    on a file that is not a regular file, the result is meaningless.
    The returned size does not take into account the end-of-line
    translations that can be performed when reading from a channel
    opened in text mode.</p>
</div>
</div>

<pre><span id="VALclose_in"><span class="keyword">val</span> close_in</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Close the given channel.  Input functions raise a <code class="code"><span class="constructor">Sys_error</span></code>
  exception when they are applied to a closed input channel,
  except <code class="code">close_in</code>, which does nothing when applied to an already
  closed channel.</p>
</div>
</div>

<pre><span id="VALclose_in_noerr"><span class="keyword">val</span> close_in_noerr</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">close_in</code>, but ignore all errors.</p>
</div>
</div>

<pre><span id="VALset_binary_mode_in"><span class="keyword">val</span> set_binary_mode_in</span> : <code class="type"><a href="Stdlib.html#TYPEin_channel">in_channel</a> -> bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_binary_mode_in&nbsp;ic&nbsp;<span class="keyword">true</span></code> sets the channel <code class="code">ic</code> to binary
   mode: no translations take place during input.
   <code class="code">set_binary_mode_out&nbsp;ic&nbsp;<span class="keyword">false</span></code> sets the channel <code class="code">ic</code> to text
   mode: depending on the operating system, some translations
   may take place during input.  For instance, under Windows,
   end-of-lines will be translated from <code class="code">\r\n</code> to <code class="code">\n</code>.
   This function has no effect under operating systems that
   do not distinguish between text mode and binary mode.</p>
</div>
</div>
<h3 id="2_Operationsonlargefiles">Operations on large files</h3>
<pre><span id="MODULELargeFile"><span class="keyword">module</span> <a href="Stdlib.LargeFile.html">LargeFile</a></span>: <code class="code"><span class="keyword">sig</span></code> <a href="Stdlib.LargeFile.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
<p>Operations on large files.</p>

</div>
<h2 id="1_References">References</h2>
<pre><code><span id="TYPEref"><span class="keyword">type</span> <code class="type">'a</code> ref</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span class="keyword">mutable&nbsp;</span><span id="TYPEELTref.contents">contents</span>&nbsp;: <code class="type">'a</code>;</code></td>

</tr></table>
<code>}</code>

<div class="info ">
<div class="info-desc">
<p>The type of references (mutable indirection cells) containing
   a value of type <code class="code"><span class="keywordsign">'</span>a</code>.</p>
</div>
</div>


<pre><span id="VALref"><span class="keyword">val</span> ref</span> : <code class="type">'a -> 'a <a href="Stdlib.html#TYPEref">ref</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return a fresh reference containing the given value.</p>
</div>
</div>

<pre><span id="VAL(!)"><span class="keyword">val</span> (!)</span> : <code class="type">'a <a href="Stdlib.html#TYPEref">ref</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">!r</code> returns the current contents of reference <code class="code">r</code>.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r.contents</code>.
   Unary operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VAL(:=)"><span class="keyword">val</span> (:=)</span> : <code class="type">'a <a href="Stdlib.html#TYPEref">ref</a> -> 'a -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">r&nbsp;:=&nbsp;a</code> stores the value of <code class="code">a</code> in reference <code class="code">r</code>.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;v&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r.contents&nbsp;&lt;-&nbsp;v</code>.
   Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>

<pre><span id="VALincr"><span class="keyword">val</span> incr</span> : <code class="type">int <a href="Stdlib.html#TYPEref">ref</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Increment the integer contained in the given reference.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r&nbsp;:=&nbsp;succ&nbsp;!r</code>.</p>
</div>
</div>

<pre><span id="VALdecr"><span class="keyword">val</span> decr</span> : <code class="type">int <a href="Stdlib.html#TYPEref">ref</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Decrement the integer contained in the given reference.
   Equivalent to <code class="code"><span class="keyword">fun</span>&nbsp;r&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;r&nbsp;:=&nbsp;pred&nbsp;!r</code>.</p>
</div>
</div>
<h2 id="1_Resulttype">Result type</h2>
<pre><code><span id="TYPEresult"><span class="keyword">type</span> <code class="type">('a, 'b)</code> result</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTresult.Ok"><span class="constructor">Ok</span></span> <span class="keyword">of</span> <code class="type">'a</code></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTresult.Error"><span class="constructor">Error</span></span> <span class="keyword">of</span> <code class="type">'b</code></code></td>

</tr></table>

<div class="info ">
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>

<h2 id="1_Operationsonformatstrings">Operations on format strings</h2><p>Format strings are character strings with special lexical conventions
  that defines the functionality of formatted input/output functions. Format
  strings are used to read data with formatted input functions from module
  <a href="Scanf.html"><code class="code"><span class="constructor">Scanf</span></code></a> and to print data with formatted output functions from modules
  <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a> and <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>.</p>

<p>Format strings are made of three kinds of entities:</p>
<ul>
<li><em>conversions specifications</em>, introduced by the special character <code class="code"><span class="string">'%'</span></code>
    followed by one or more characters specifying what kind of argument to
    read or print,</li>
<li><em>formatting indications</em>, introduced by the special character <code class="code"><span class="string">'@'</span></code>
    followed by one or more characters specifying how to read or print the
    argument,</li>
<li><em>plain characters</em> that are regular characters with usual lexical
    conventions. Plain characters specify string literals to be read in the
    input or printed in the output.</li>
</ul>
<p>There is an additional lexical rule to escape the special characters <code class="code"><span class="string">'%'</span></code>
  and <code class="code"><span class="string">'@'</span></code> in format strings: if a special character follows a <code class="code"><span class="string">'%'</span></code>
  character, it is treated as a plain character. In other words, <code class="code"><span class="string">"%%"</span></code> is
  considered as a plain <code class="code"><span class="string">'%'</span></code> and <code class="code"><span class="string">"%@"</span></code> as a plain <code class="code"><span class="string">'@'</span></code>.</p>

<p>For more information about conversion specifications and formatting
  indications available, read the documentation of modules <a href="Scanf.html"><code class="code"><span class="constructor">Scanf</span></code></a>,
  <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a> and <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>.</p>
<p>Format strings have a general and highly polymorphic type
    <code class="code">(<span class="keywordsign">'</span>a,&nbsp;<span class="keywordsign">'</span>b,&nbsp;<span class="keywordsign">'</span>c,&nbsp;<span class="keywordsign">'</span>d,&nbsp;<span class="keywordsign">'</span>e,&nbsp;<span class="keywordsign">'</span>f)&nbsp;format6</code>.
    The two simplified types, <code class="code">format</code> and <code class="code">format4</code> below are
    included for backward compatibility with earlier releases of
    OCaml.</p>

<p>The meaning of format string type parameters is as follows:</p>

<ul>
<li><code class="code"><span class="keywordsign">'</span>a</code> is the type of the parameters of the format for formatted output
      functions (<code class="code">printf</code>-style functions);
      <code class="code"><span class="keywordsign">'</span>a</code> is the type of the values read by the format for formatted input
      functions (<code class="code">scanf</code>-style functions).</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>b</code> is the type of input source for formatted input functions and the
      type of output target for formatted output functions.
      For <code class="code">printf</code>-style functions from module <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <code class="code">out_channel</code>;
      for <code class="code">printf</code>-style functions from module <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <a href="Format.html#TYPEformatter"><code class="code"><span class="constructor">Format</span>.formatter</code></a>;
      for <code class="code">scanf</code>-style functions from module <a href="Scanf.html"><code class="code"><span class="constructor">Scanf</span></code></a>, <code class="code"><span class="keywordsign">'</span>b</code> is typically
      <a href="Scanf.Scanning.html#TYPEin_channel"><code class="code"><span class="constructor">Scanf</span>.<span class="constructor">Scanning</span>.in_channel</code></a>.</li>
</ul>
<p>Type argument <code class="code"><span class="keywordsign">'</span>b</code> is also the type of the first argument given to
      user's defined printing functions for <code class="code">%a</code> and <code class="code">%t</code> conversions,
      and user's defined reading functions for <code class="code">%r</code> conversion.</p>

<ul>
<li><code class="code"><span class="keywordsign">'</span>c</code> is the type of the result of the <code class="code">%a</code> and <code class="code">%t</code> printing
      functions, and also the type of the argument transmitted to the
      first argument of <code class="code">kprintf</code>-style functions or to the
      <code class="code">kscanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>d</code> is the type of parameters for the <code class="code">scanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>e</code> is the type of the receiver function for the <code class="code">scanf</code>-style functions.</li>
</ul>
<ul>
<li><code class="code"><span class="keywordsign">'</span>f</code> is the final result type of a formatted input/output function
      invocation: for the <code class="code">printf</code>-style functions, it is typically <code class="code">unit</code>;
      for the <code class="code">scanf</code>-style functions, it is typically the result type of the
      receiver function.</li>
</ul>

<pre><span id="TYPEformat6"><span class="keyword">type</span> <code class="type">('a, 'b, 'c, 'd, 'e, 'f)</code> format6</span> = <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="CamlinternalFormatBasics.html#TYPEformat6">CamlinternalFormatBasics.format6</a></code> </pre>


<pre><span id="TYPEformat4"><span class="keyword">type</span> <code class="type">('a, 'b, 'c, 'd)</code> format4</span> = <code class="type">('a, 'b, 'c, 'c, 'c, 'd) <a href="Stdlib.html#TYPEformat6">format6</a></code> </pre>


<pre><span id="TYPEformat"><span class="keyword">type</span> <code class="type">('a, 'b, 'c)</code> format</span> = <code class="type">('a, 'b, 'c, 'c) <a href="Stdlib.html#TYPEformat4">format4</a></code> </pre>


<pre><span id="VALstring_of_format"><span class="keyword">val</span> string_of_format</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Stdlib.html#TYPEformat6">format6</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Converts a format string into a string.</p>
</div>
</div>

<pre><span id="VALformat_of_string"><span class="keyword">val</span> format_of_string</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Stdlib.html#TYPEformat6">format6</a> -><br>       ('a, 'b, 'c, 'd, 'e, 'f) <a href="Stdlib.html#TYPEformat6">format6</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">format_of_string&nbsp;s</code> returns a format string read from the string
    literal <code class="code">s</code>.
    Note: <code class="code">format_of_string</code> can not convert a string argument that is not a
    literal. If you need this functionality, use the more general
    <a href="Scanf.html#VALformat_from_string"><code class="code"><span class="constructor">Scanf</span>.format_from_string</code></a> function.</p>
</div>
</div>

<pre><span id="VAL(^^)"><span class="keyword">val</span> (^^)</span> : <code class="type">('a, 'b, 'c, 'd, 'e, 'f) <a href="Stdlib.html#TYPEformat6">format6</a> -><br>       ('f, 'b, 'c, 'e, 'g, 'h) <a href="Stdlib.html#TYPEformat6">format6</a> -><br>       ('a, 'b, 'c, 'd, 'g, 'h) <a href="Stdlib.html#TYPEformat6">format6</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">f1&nbsp;^^&nbsp;f2</code> catenates format strings <code class="code">f1</code> and <code class="code">f2</code>. The result is a
  format string that behaves as the concatenation of format strings <code class="code">f1</code> and
  <code class="code">f2</code>: in case of formatted output, it accepts arguments from <code class="code">f1</code>, then
  arguments from <code class="code">f2</code>; in case of formatted input, it returns results from
  <code class="code">f1</code>, then results from <code class="code">f2</code>.
  Right-associative operator, see <a href="Ocaml_operators.html"><code class="code"><span class="constructor">Ocaml_operators</span></code></a> for more information.</p>
</div>
</div>
<h2 id="1_Programtermination">Program termination</h2>
<pre><span id="VALexit"><span class="keyword">val</span> exit</span> : <code class="type">int -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Terminate the process, returning the given status code
   to the operating system: usually 0 to indicate no errors,
   and a small positive integer to indicate failure.
   All open output channels are flushed with <code class="code">flush_all</code>.
   An implicit <code class="code">exit&nbsp;0</code> is performed each time a program
   terminates normally.  An implicit <code class="code">exit&nbsp;2</code> is performed if the program
   terminates early because of an uncaught exception.</p>
</div>
</div>

<pre><span id="VALat_exit"><span class="keyword">val</span> at_exit</span> : <code class="type">(unit -> unit) -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Register the given function to be called at program termination
   time. The functions registered with <code class="code">at_exit</code> will be called when
   the program does any of the following:</p>
<ul>
<li>executes <a href="Stdlib.html#VALexit"><code class="code">exit</code></a></li>
<li>terminates, either normally or because of an uncaught
     exception</li>
<li>executes the C function <code class="code">caml_shutdown</code>.
   The functions are called in 'last in, first out' order: the
   function most recently added with <code class="code">at_exit</code> is called first.</li>
</ul>
</div>
</div>
<h2 id="modules">Standard library modules </h2>
<pre><span id="MODULEArg"><span class="keyword">module</span> <a href="Stdlib.Arg.html">Arg</a></span>: <code class="type"><a href="Arg.html">Arg</a></code></pre>
<pre><span id="MODULEArray"><span class="keyword">module</span> <a href="Stdlib.Array.html">Array</a></span>: <code class="type"><a href="Array.html">Array</a></code></pre>
<pre><span id="MODULEArrayLabels"><span class="keyword">module</span> <a href="Stdlib.ArrayLabels.html">ArrayLabels</a></span>: <code class="type"><a href="ArrayLabels.html">ArrayLabels</a></code></pre>
<pre><span id="MODULEBigarray"><span class="keyword">module</span> <a href="Stdlib.Bigarray.html">Bigarray</a></span>: <code class="type"><a href="Bigarray.html">Bigarray</a></code></pre>
<pre><span id="MODULEBool"><span class="keyword">module</span> <a href="Stdlib.Bool.html">Bool</a></span>: <code class="type"><a href="Bool.html">Bool</a></code></pre>
<pre><span id="MODULEBuffer"><span class="keyword">module</span> <a href="Stdlib.Buffer.html">Buffer</a></span>: <code class="type"><a href="Buffer.html">Buffer</a></code></pre>
<pre><span id="MODULEBytes"><span class="keyword">module</span> <a href="Stdlib.Bytes.html">Bytes</a></span>: <code class="type"><a href="Bytes.html">Bytes</a></code></pre>
<pre><span id="MODULEBytesLabels"><span class="keyword">module</span> <a href="Stdlib.BytesLabels.html">BytesLabels</a></span>: <code class="type"><a href="BytesLabels.html">BytesLabels</a></code></pre>
<pre><span id="MODULECallback"><span class="keyword">module</span> <a href="Stdlib.Callback.html">Callback</a></span>: <code class="type"><a href="Callback.html">Callback</a></code></pre>
<pre><span id="MODULEChar"><span class="keyword">module</span> <a href="Stdlib.Char.html">Char</a></span>: <code class="type"><a href="Char.html">Char</a></code></pre>
<pre><span id="MODULEComplex"><span class="keyword">module</span> <a href="Stdlib.Complex.html">Complex</a></span>: <code class="type"><a href="Complex.html">Complex</a></code></pre>
<pre><span id="MODULEDigest"><span class="keyword">module</span> <a href="Stdlib.Digest.html">Digest</a></span>: <code class="type"><a href="Digest.html">Digest</a></code></pre>
<pre><span id="MODULEEphemeron"><span class="keyword">module</span> <a href="Stdlib.Ephemeron.html">Ephemeron</a></span>: <code class="type"><a href="Ephemeron.html">Ephemeron</a></code></pre>
<pre><span id="MODULEFilename"><span class="keyword">module</span> <a href="Stdlib.Filename.html">Filename</a></span>: <code class="type"><a href="Filename.html">Filename</a></code></pre>
<pre><span id="MODULEFloat"><span class="keyword">module</span> <a href="Stdlib.Float.html">Float</a></span>: <code class="type"><a href="Float.html">Float</a></code></pre>
<pre><span id="MODULEFormat"><span class="keyword">module</span> <a href="Stdlib.Format.html">Format</a></span>: <code class="type"><a href="Format.html">Format</a></code></pre>
<pre><span id="MODULEFun"><span class="keyword">module</span> <a href="Stdlib.Fun.html">Fun</a></span>: <code class="type"><a href="Fun.html">Fun</a></code></pre>
<pre><span id="MODULEGc"><span class="keyword">module</span> <a href="Stdlib.Gc.html">Gc</a></span>: <code class="type"><a href="Gc.html">Gc</a></code></pre>
<pre><span id="MODULEGenlex"><span class="keyword">module</span> <a href="Stdlib.Genlex.html">Genlex</a></span>: <code class="type"><a href="Genlex.html">Genlex</a></code></pre>
<pre><span id="MODULEHashtbl"><span class="keyword">module</span> <a href="Stdlib.Hashtbl.html">Hashtbl</a></span>: <code class="type"><a href="Hashtbl.html">Hashtbl</a></code></pre>
<pre><span id="MODULEInt"><span class="keyword">module</span> <a href="Stdlib.Int.html">Int</a></span>: <code class="type"><a href="Int.html">Int</a></code></pre>
<pre><span id="MODULEInt32"><span class="keyword">module</span> <a href="Stdlib.Int32.html">Int32</a></span>: <code class="type"><a href="Int32.html">Int32</a></code></pre>
<pre><span id="MODULEInt64"><span class="keyword">module</span> <a href="Stdlib.Int64.html">Int64</a></span>: <code class="type"><a href="Int64.html">Int64</a></code></pre>
<pre><span id="MODULELazy"><span class="keyword">module</span> <a href="Stdlib.Lazy.html">Lazy</a></span>: <code class="type"><a href="Lazy.html">Lazy</a></code></pre>
<pre><span id="MODULELexing"><span class="keyword">module</span> <a href="Stdlib.Lexing.html">Lexing</a></span>: <code class="type"><a href="Lexing.html">Lexing</a></code></pre>
<pre><span id="MODULEList"><span class="keyword">module</span> <a href="Stdlib.List.html">List</a></span>: <code class="type"><a href="List.html">List</a></code></pre>
<pre><span id="MODULEListLabels"><span class="keyword">module</span> <a href="Stdlib.ListLabels.html">ListLabels</a></span>: <code class="type"><a href="ListLabels.html">ListLabels</a></code></pre>
<pre><span id="MODULEMap"><span class="keyword">module</span> <a href="Stdlib.Map.html">Map</a></span>: <code class="type"><a href="Map.html">Map</a></code></pre>
<pre><span id="MODULEMarshal"><span class="keyword">module</span> <a href="Stdlib.Marshal.html">Marshal</a></span>: <code class="type"><a href="Marshal.html">Marshal</a></code></pre>
<pre><span id="MODULEMoreLabels"><span class="keyword">module</span> <a href="Stdlib.MoreLabels.html">MoreLabels</a></span>: <code class="type"><a href="MoreLabels.html">MoreLabels</a></code></pre>
<pre><span id="MODULENativeint"><span class="keyword">module</span> <a href="Stdlib.Nativeint.html">Nativeint</a></span>: <code class="type"><a href="Nativeint.html">Nativeint</a></code></pre>
<pre><span id="MODULEObj"><span class="keyword">module</span> <a href="Stdlib.Obj.html">Obj</a></span>: <code class="type"><a href="Obj.html">Obj</a></code></pre>
<pre><span id="MODULEOo"><span class="keyword">module</span> <a href="Stdlib.Oo.html">Oo</a></span>: <code class="type"><a href="Oo.html">Oo</a></code></pre>
<pre><span id="MODULEOption"><span class="keyword">module</span> <a href="Stdlib.Option.html">Option</a></span>: <code class="type"><a href="Option.html">Option</a></code></pre>
<pre><span id="MODULEParsing"><span class="keyword">module</span> <a href="Stdlib.Parsing.html">Parsing</a></span>: <code class="type"><a href="Parsing.html">Parsing</a></code></pre>
<pre><span id="MODULEPervasives"><span class="keyword">module</span> <a href="Stdlib.Pervasives.html">Pervasives</a></span>: <code class="type">Pervasives</code></pre>
<pre><span id="MODULEPrintexc"><span class="keyword">module</span> <a href="Stdlib.Printexc.html">Printexc</a></span>: <code class="type"><a href="Printexc.html">Printexc</a></code></pre>
<pre><span id="MODULEPrintf"><span class="keyword">module</span> <a href="Stdlib.Printf.html">Printf</a></span>: <code class="type"><a href="Printf.html">Printf</a></code></pre>
<pre><span id="MODULEQueue"><span class="keyword">module</span> <a href="Stdlib.Queue.html">Queue</a></span>: <code class="type"><a href="Queue.html">Queue</a></code></pre>
<pre><span id="MODULERandom"><span class="keyword">module</span> <a href="Stdlib.Random.html">Random</a></span>: <code class="type"><a href="Random.html">Random</a></code></pre>
<pre><span id="MODULEResult"><span class="keyword">module</span> <a href="Stdlib.Result.html">Result</a></span>: <code class="type"><a href="Result.html">Result</a></code></pre>
<pre><span id="MODULEScanf"><span class="keyword">module</span> <a href="Stdlib.Scanf.html">Scanf</a></span>: <code class="type"><a href="Scanf.html">Scanf</a></code></pre>
<pre><span id="MODULESeq"><span class="keyword">module</span> <a href="Stdlib.Seq.html">Seq</a></span>: <code class="type"><a href="Seq.html">Seq</a></code></pre>
<pre><span id="MODULESet"><span class="keyword">module</span> <a href="Stdlib.Set.html">Set</a></span>: <code class="type"><a href="Set.html">Set</a></code></pre>
<pre><span id="MODULESpacetime"><span class="keyword">module</span> <a href="Stdlib.Spacetime.html">Spacetime</a></span>: <code class="type"><a href="Spacetime.html">Spacetime</a></code></pre>
<pre><span id="MODULEStack"><span class="keyword">module</span> <a href="Stdlib.Stack.html">Stack</a></span>: <code class="type"><a href="Stack.html">Stack</a></code></pre>
<pre><span id="MODULEStdLabels"><span class="keyword">module</span> <a href="Stdlib.StdLabels.html">StdLabels</a></span>: <code class="type"><a href="StdLabels.html">StdLabels</a></code></pre>
<pre><span id="MODULEStream"><span class="keyword">module</span> <a href="Stdlib.Stream.html">Stream</a></span>: <code class="type"><a href="Stream.html">Stream</a></code></pre>
<pre><span id="MODULEString"><span class="keyword">module</span> <a href="Stdlib.String.html">String</a></span>: <code class="type"><a href="String.html">String</a></code></pre>
<pre><span id="MODULEStringLabels"><span class="keyword">module</span> <a href="Stdlib.StringLabels.html">StringLabels</a></span>: <code class="type"><a href="StringLabels.html">StringLabels</a></code></pre>
<pre><span id="MODULESys"><span class="keyword">module</span> <a href="Stdlib.Sys.html">Sys</a></span>: <code class="type"><a href="Sys.html">Sys</a></code></pre>
<pre><span id="MODULEUchar"><span class="keyword">module</span> <a href="Stdlib.Uchar.html">Uchar</a></span>: <code class="type"><a href="Uchar.html">Uchar</a></code></pre>
<pre><span id="MODULEUnit"><span class="keyword">module</span> <a href="Stdlib.Unit.html">Unit</a></span>: <code class="type"><a href="Unit.html">Unit</a></code></pre>
<pre><span id="MODULEWeak"><span class="keyword">module</span> <a href="Stdlib.Weak.html">Weak</a></span>: <code class="type"><a href="Weak.html">Weak</a></code></pre></body></html>