/usr/share/doc/libcln-dev/html/cln.html is in libcln-dev 1.3.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>CLN, a Class Library for Numbers</title>
<meta name="description" content="CLN, a Class Library for Numbers">
<meta name="keywords" content="CLN, a Class Library for Numbers">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="#Top" rel="start" title="Top">
<link href="#Index" rel="index" title="Index">
<link href="dir.html#Top" rel="up" title="(dir)">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<h1 class="settitle" align="center">CLN, a Class Library for Numbers</h1>
<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="CLN"></a>
<h1 class="top">CLN</h1>
<p>This manual documents <small>CLN</small>, a Class Library for Numbers.
</p>
<p>Published by Bruno Haible, <code><haible@clisp.cons.org></code> and
Richard B. Kreckel, <code><kreckel@ginac.de></code>.
</p>
<p>Copyright (C) Bruno Haible 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008.
Copyright (C) Richard B. Kreckel 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014.
Copyright (C) Alexei Sheplyakov 2008, 2010.
</p>
<p>Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
</p>
<p>Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
</p>
<p>Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation approved
by the author.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Introduction" accesskey="1">Introduction</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Installation" accesskey="2">Installation</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Ordinary-number-types" accesskey="3">Ordinary number types</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-numbers" accesskey="4">Functions on numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Input_002fOutput" accesskey="5">Input/Output</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Rings" accesskey="6">Rings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Modular-integers" accesskey="7">Modular integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Symbolic-data-types" accesskey="8">Symbolic data types</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Univariate-polynomials" accesskey="9">Univariate polynomials</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Internals">Internals</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Using-the-library">Using the library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Customizing">Customizing</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Index">Index</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr><tr><th colspan="3" align="left" valign="top"><pre class="menu-comment"> — The Detailed Node Listing —
Installation
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Prerequisites">Prerequisites</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Building-the-library">Building the library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Installing-the-library">Installing the library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Cleaning-up">Cleaning up</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Prerequisites
</pre></th></tr><tr><td align="left" valign="top">• <a href="#C_002b_002b-compiler">C++ compiler</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Make-utility">Make utility</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Sed-utility">Sed utility</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Building the library
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Using-the-GNU-MP-Library">Using the GNU MP Library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Ordinary number types
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Exact-numbers">Exact numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Floating_002dpoint-numbers">Floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Complex-numbers">Complex numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversions">Conversions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Functions on numbers
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Constructing-numbers">Constructing numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-functions">Elementary functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-rational-functions">Elementary rational functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-complex-functions">Elementary complex functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Comparisons">Comparisons</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Rounding-functions">Rounding functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Roots">Roots</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Transcendental-functions">Transcendental functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-integers">Functions on integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversion-functions">Conversion functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Random-number-generators">Random number generators</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Modifying-operators">Modifying operators</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Constructing numbers
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Constructing-integers">Constructing integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-rational-numbers">Constructing rational numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-floating_002dpoint-numbers">Constructing floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-complex-numbers">Constructing complex numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Transcendental functions
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Trigonometric-functions">Trigonometric functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Hyperbolic-functions">Hyperbolic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Euler-gamma">Euler gamma</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Riemann-zeta">Riemann zeta</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Functions on integers
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Logical-functions">Logical functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Number-theoretic-functions">Number theoretic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Combinatorial-functions">Combinatorial functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Conversion functions
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversion-to-rational-numbers">Conversion to rational numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Input/Output
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Internal-and-printed-representation">Internal and printed representation</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Input-functions">Input functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Output-functions">Output functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Modular integers
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Modular-integer-rings">Modular integer rings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-modular-integers">Functions on modular integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Symbolic data types
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Strings">Strings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Symbols">Symbols</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Univariate polynomials
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Univariate-polynomial-rings">Univariate polynomial rings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Special-polynomials">Special polynomials</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Internals
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Why-C_002b_002b-_003f">Why C++ ?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Memory-efficiency">Memory efficiency</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Speed-efficiency">Speed efficiency</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Garbage-collection">Garbage collection</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Using the library
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Compiler-options">Compiler options</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Include-files">Include files</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#An-Example">An Example</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Debugging-support">Debugging support</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Reporting-Problems">Reporting Problems</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
Customizing
</pre></th></tr><tr><td align="left" valign="top">• <a href="#Error-handling">Error handling</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Floating_002dpoint-underflow">Floating-point underflow</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Customizing-I_002fO">Customizing I/O</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Customizing-the-memory-allocator">Customizing the memory allocator</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr></table>
<hr>
<a name="Introduction"></a>
<div class="header">
<p>
Next: <a href="#Installation" accesskey="n" rel="next">Installation</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introduction-1"></a>
<h2 class="chapter">1 Introduction</h2>
<p>CLN is a library for computations with all kinds of numbers.
It has a rich set of number classes:
</p>
<ul>
<li> Integers (with unlimited precision),
</li><li> Rational numbers,
</li><li> Floating-point numbers:
<ul class="no-bullet">
<li>- Short float,
</li><li>- Single float,
</li><li>- Double float,
</li><li>- Long float (with unlimited precision),
</li></ul>
</li><li> Complex numbers,
</li><li> Modular integers (integers modulo a fixed integer),
</li><li> Univariate polynomials.
</li></ul>
<p>The subtypes of the complex numbers among these are exactly the
types of numbers known to the Common Lisp language. Therefore
<code>CLN</code> can be used for Common Lisp implementations, giving
‘<samp>CLN</samp>’ another meaning: it becomes an abbreviation of
“Common Lisp Numbers”.
</p>
<p>The CLN package implements
</p>
<ul>
<li> Elementary functions (<code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>sqrt</code>,
comparisons, …),
</li><li> Logical functions (logical <code>and</code>, <code>or</code>, <code>not</code>, …),
</li><li> Transcendental functions (exponential, logarithmic, trigonometric, hyperbolic
functions and their inverse functions).
</li></ul>
<p>CLN is a C++ library. Using C++ as an implementation language provides
</p>
<ul>
<li> efficiency: it compiles to machine code,
</li><li> type safety: the C++ compiler knows about the number types and complains
if, for example, you try to assign a float to an integer variable.
</li><li> algebraic syntax: You can use the <code>+</code>, <code>-</code>, <code>*</code>, <code>=</code>,
<code>==</code>, … operators as in C or C++.
</li></ul>
<p>CLN is memory efficient:
</p>
<ul>
<li> Small integers and short floats are immediate, not heap allocated.
</li><li> Heap-allocated memory is reclaimed through an automatic, non-interruptive
garbage collection.
</li></ul>
<p>CLN is speed efficient:
</p>
<ul>
<li> The kernel of CLN has been written in assembly language for some CPUs
(<code>i386</code>, <code>m68k</code>, <code>sparc</code>, <code>mips</code>, <code>arm</code>).
</li><li> <a name="index-GMP"></a>
On all CPUs, CLN may be configured to use the superefficient low-level
routines from GNU GMP version 3.
</li><li> It uses Karatsuba multiplication, which is significantly faster
for large numbers than the standard multiplication algorithm.
</li><li> For very large numbers (more than 12000 decimal digits), it uses
multiplication, which is an asymptotically optimal multiplication
algorithm, for multiplication, division and radix conversion.
</li><li> <a name="index-binary-splitting"></a>
It uses binary splitting for fast evaluation of series of rational
numbers as they occur in the evaluation of elementary functions and some
constants.
</li></ul>
<p>CLN aims at being easily integrated into larger software packages:
</p>
<ul>
<li> The garbage collection imposes no burden on the main application.
</li><li> The library provides hooks for memory allocation and throws exceptions
in case of errors.
</li><li> <a name="index-namespace"></a>
All non-macro identifiers are hidden in namespace <code>cln</code> in
order to avoid name clashes.
</li></ul>
<hr>
<a name="Installation"></a>
<div class="header">
<p>
Next: <a href="#Ordinary-number-types" accesskey="n" rel="next">Ordinary number types</a>, Previous: <a href="#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installation-1"></a>
<h2 class="chapter">2 Installation</h2>
<p>This section describes how to install the CLN package on your system.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Prerequisites" accesskey="1">Prerequisites</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Building-the-library" accesskey="2">Building the library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Installing-the-library" accesskey="3">Installing the library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Cleaning-up" accesskey="4">Cleaning up</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Prerequisites"></a>
<div class="header">
<p>
Next: <a href="#Building-the-library" accesskey="n" rel="next">Building the library</a>, Previous: <a href="#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="#Installation" accesskey="u" rel="up">Installation</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Prerequisites-1"></a>
<h3 class="section">2.1 Prerequisites</h3>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#C_002b_002b-compiler" accesskey="1">C++ compiler</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Make-utility" accesskey="2">Make utility</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Sed-utility" accesskey="3">Sed utility</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="C_002b_002b-compiler"></a>
<div class="header">
<p>
Next: <a href="#Make-utility" accesskey="n" rel="next">Make utility</a>, Up: <a href="#Prerequisites" accesskey="u" rel="up">Prerequisites</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="C_002b_002b-compiler-1"></a>
<h4 class="subsection">2.1.1 C++ compiler</h4>
<p>To build CLN, you need a C++ compiler.
GNU <code>g++ 4.0.0</code> or newer is recommended.
</p>
<p>The following C++ features are used:
classes, member functions, overloading of functions and operators,
constructors and destructors, inline, const, multiple inheritance,
templates and namespaces.
</p>
<p>The following C++ features are not used:
<code>new</code>, <code>delete</code>, virtual inheritance.
</p>
<p>CLN relies on semi-automatic ordering of initializations of static and
global variables, a feature which I could implement for GNU g++
only. Also, it is not known whether this semi-automatic ordering works
on all platforms when a non-GNU assembler is being used.
</p>
<hr>
<a name="Make-utility"></a>
<div class="header">
<p>
Next: <a href="#Sed-utility" accesskey="n" rel="next">Sed utility</a>, Previous: <a href="#C_002b_002b-compiler" accesskey="p" rel="prev">C++ compiler</a>, Up: <a href="#Prerequisites" accesskey="u" rel="up">Prerequisites</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Make-utility-1"></a>
<h4 class="subsection">2.1.2 Make utility</h4>
<a name="index-make"></a>
<p>To build CLN, you also need to have GNU <code>make</code> installed.
</p>
<hr>
<a name="Sed-utility"></a>
<div class="header">
<p>
Previous: <a href="#Make-utility" accesskey="p" rel="prev">Make utility</a>, Up: <a href="#Prerequisites" accesskey="u" rel="up">Prerequisites</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Sed-utility-1"></a>
<h4 class="subsection">2.1.3 Sed utility</h4>
<a name="index-sed"></a>
<p>To build CLN on HP-UX, you also need to have GNU <code>sed</code> installed.
This is because the libtool script, which creates the CLN library, relies
on <code>sed</code>, and the vendor’s <code>sed</code> utility on these systems is too
limited.
</p>
<hr>
<a name="Building-the-library"></a>
<div class="header">
<p>
Next: <a href="#Installing-the-library" accesskey="n" rel="next">Installing the library</a>, Previous: <a href="#Prerequisites" accesskey="p" rel="prev">Prerequisites</a>, Up: <a href="#Installation" accesskey="u" rel="up">Installation</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Building-the-library-1"></a>
<h3 class="section">2.2 Building the library</h3>
<p>As with any autoconfiguring GNU software, installation is as easy as this:
</p>
<div class="example">
<pre class="example">$ ./configure
$ make
$ make check
</pre></div>
<p>If on your system, ‘<samp>make</samp>’ is not GNU <code>make</code>, you have to use
‘<samp>gmake</samp>’ instead of ‘<samp>make</samp>’ above.
</p>
<p>The <code>configure</code> command checks out some features of your system and
C++ compiler and builds the <code>Makefile</code>s. The <code>make</code> command
builds the library. This step may take about half an hour on an average
workstation. The <code>make check</code> runs some test to check that no
important subroutine has been miscompiled.
</p>
<p>The <code>configure</code> command accepts options. To get a summary of them, try
</p>
<div class="example">
<pre class="example">$ ./configure --help
</pre></div>
<p>Some of the options are explained in detail in the ‘<samp>INSTALL.generic</samp>’ file.
</p>
<p>You can specify the C compiler, the C++ compiler and their options through
the following environment variables when running <code>configure</code>:
</p>
<dl compact="compact">
<dt><code>CC</code></dt>
<dd><p>Specifies the C compiler.
</p>
</dd>
<dt><code>CFLAGS</code></dt>
<dd><p>Flags to be given to the C compiler when compiling programs (not when linking).
</p>
</dd>
<dt><code>CXX</code></dt>
<dd><p>Specifies the C++ compiler.
</p>
</dd>
<dt><code>CXXFLAGS</code></dt>
<dd><p>Flags to be given to the C++ compiler when compiling programs (not when linking).
</p>
</dd>
<dt><code>CPPFLAGS</code></dt>
<dd><p>Flags to be given to the C/C++ preprocessor.
</p>
</dd>
<dt><code>LDFLAGS</code></dt>
<dd><p>Flags to be given to the linker.
</p></dd>
</dl>
<p>Examples:
</p>
<div class="example">
<pre class="example">$ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
</pre></div>
<div class="example">
<pre class="example">$ CC="gcc -V 3.2.3" CFLAGS="-O2 -finline-limit=1000" \
CXX="g++ -V 3.2.3" CXXFLAGS="-O2 -finline-limit=1000" \
CPPFLAGS="-DNO_ASM" ./configure
</pre></div>
<div class="example">
<pre class="example">$ CC="gcc-4.2" CFLAGS="-O2" CXX="g++-4.2" CXXFLAGS="-O2" ./configure
</pre></div>
<p>Note that for these environment variables to take effect, you have to set
them (assuming a Bourne-compatible shell) on the same line as the
<code>configure</code> command. If you made the settings in earlier shell
commands, you have to <code>export</code> the environment variables before
calling <code>configure</code>. In a <code>csh</code> shell, you have to use the
‘<samp>setenv</samp>’ command for setting each of the environment variables.
</p>
<p>Currently CLN works only with the GNU <code>g++</code> compiler, and only in
optimizing mode. So you should specify at least <code>-O</code> in the
CXXFLAGS, or no CXXFLAGS at all. If CXXFLAGS is not set, CLN will be
compiled with <code>-O</code>.
</p>
<p>The assembler language kernel can be turned off by specifying
<code>-DNO_ASM</code> in the CPPFLAGS. If <code>make check</code> reports any
problems, you may try to clean up (see <a href="#Cleaning-up">Cleaning up</a>) and configure
and compile again, this time with <code>-DNO_ASM</code>.
</p>
<p>If you use <code>g++</code> 3.2.x or earlier, I recommend adding
‘<samp>-finline-limit=1000</samp>’ to the CXXFLAGS. This is essential for good
code.
</p>
<p>If you use <code>g++</code> from gcc-3.0.4 or older on Sparc, add either
‘<samp>-O</samp>’, ‘<samp>-O1</samp>’ or ‘<samp>-O2 -fno-schedule-insns</samp>’ to the
CXXFLAGS. With full ‘<samp>-O2</samp>’, <code>g++</code> miscompiles the division
routines. Also, do not use gcc-3.0 on Sparc for compiling CLN, it
won’t work at all.
</p>
<p>Also, please do not compile CLN with <code>g++</code> using the <code>-O3</code>
optimization level. This leads to inferior code quality.
</p>
<p>Some newer versions of <code>g++</code> require quite an amount of memory.
You might need some swap space if your machine doesn’t have 512 MB of
RAM.
</p>
<p>By default, both a shared and a static library are built. You can build
CLN as a static (or shared) library only, by calling <code>configure</code>
with the option ‘<samp>--disable-shared</samp>’ (or ‘<samp>--disable-static</samp>’).
While shared libraries are usually more convenient to use, they may not
work on all architectures. Try disabling them if you run into linker
problems. Also, they are generally slightly slower than static
libraries so runtime-critical applications should be linked statically.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Using-the-GNU-MP-Library" accesskey="1">Using the GNU MP Library</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Using-the-GNU-MP-Library"></a>
<div class="header">
<p>
Up: <a href="#Building-the-library" accesskey="u" rel="up">Building the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-the-GNU-MP-Library-1"></a>
<h4 class="subsection">2.2.1 Using the GNU MP Library</h4>
<a name="index-GMP-1"></a>
<p>CLN may be configured to make use of a preinstalled <code>gmp</code> library
for some low-level routines. Please make sure that you have at least
<code>gmp</code> version 3.0 installed since earlier versions are unsupported
and likely not to work. Using <code>gmp</code> is known to be quite a boost
for CLN’s performance.
</p>
<p>By default, CLN will autodetect <code>gmp</code> and use it. If you do not
want CLN to make use of a preinstalled <code>gmp</code> library, then you can
explicitly specify so by calling <code>configure</code> with the option
‘<samp>--without-gmp</samp>’.
</p>
<p>If you have installed the <code>gmp</code> library and its header files in
some place where the compiler cannot find it by default, you must help
<code>configure</code> and specify the prefix that was used when <code>gmp</code>
was configured. Here is an example:
</p>
<div class="example">
<pre class="example">$ ./configure --with-gmp=/opt/gmp-4.2.2
</pre></div>
<p>This assumes that the <code>gmp</code> header files have been installed in
<samp>/opt/gmp-4.2.2/include/</samp> and the library in
<samp>/opt/gmp-4.2.2/lib/</samp>. More uncommon GMP installations can be
handled by setting CPPFLAGS and LDFLAGS appropriately prior to running
<code>configure</code>.
</p>
<hr>
<a name="Installing-the-library"></a>
<div class="header">
<p>
Next: <a href="#Cleaning-up" accesskey="n" rel="next">Cleaning up</a>, Previous: <a href="#Building-the-library" accesskey="p" rel="prev">Building the library</a>, Up: <a href="#Installation" accesskey="u" rel="up">Installation</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Installing-the-library-1"></a>
<h3 class="section">2.3 Installing the library</h3>
<a name="index-installation"></a>
<p>As with any autoconfiguring GNU software, installation is as easy as this:
</p>
<div class="example">
<pre class="example">$ make install
</pre></div>
<p>The ‘<samp>make install</samp>’ command installs the library and the include files
into public places (<samp>/usr/local/lib/</samp> and <samp>/usr/local/include/</samp>,
if you haven’t specified a <code>--prefix</code> option to <code>configure</code>).
This step may require superuser privileges.
</p>
<p>If you have already built the library and wish to install it, but didn’t
specify <code>--prefix=…</code> at configure time, just re-run
<code>configure</code>, giving it the same options as the first time, plus
the <code>--prefix=…</code> option.
</p>
<hr>
<a name="Cleaning-up"></a>
<div class="header">
<p>
Previous: <a href="#Installing-the-library" accesskey="p" rel="prev">Installing the library</a>, Up: <a href="#Installation" accesskey="u" rel="up">Installation</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Cleaning-up-1"></a>
<h3 class="section">2.4 Cleaning up</h3>
<p>You can remove system-dependent files generated by <code>make</code> through
</p>
<div class="example">
<pre class="example">$ make clean
</pre></div>
<p>You can remove all files generated by <code>make</code>, thus reverting to a
virgin distribution of CLN, through
</p>
<div class="example">
<pre class="example">$ make distclean
</pre></div>
<hr>
<a name="Ordinary-number-types"></a>
<div class="header">
<p>
Next: <a href="#Functions-on-numbers" accesskey="n" rel="next">Functions on numbers</a>, Previous: <a href="#Installation" accesskey="p" rel="prev">Installation</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Ordinary-number-types-1"></a>
<h2 class="chapter">3 Ordinary number types</h2>
<p>CLN implements the following class hierarchy:
</p>
<div class="example">
<pre class="example"> Number
cl_number
<cln/number.h>
|
|
Real or complex number
cl_N
<cln/complex.h>
|
|
Real number
cl_R
<cln/real.h>
|
+-------------------+-------------------+
| |
Rational number Floating-point number
cl_RA cl_F
<cln/rational.h> <cln/float.h>
| |
| +--------------+--------------+--------------+
Integer | | | |
cl_I Short-Float Single-Float Double-Float Long-Float
<cln/integer.h> cl_SF cl_FF cl_DF cl_LF
<cln/sfloat.h> <cln/ffloat.h> <cln/dfloat.h> <cln/lfloat.h>
</pre></div>
<a name="index-cl_005fnumber"></a>
<a name="index-abstract-class"></a>
<p>The base class <code>cl_number</code> is an abstract base class.
It is not useful to declare a variable of this type except if you want
to completely disable compile-time type checking and use run-time type
checking instead.
</p>
<a name="index-cl_005fN"></a>
<a name="index-real-number"></a>
<a name="index-complex-number"></a>
<p>The class <code>cl_N</code> comprises real and complex numbers. There is
no special class for complex numbers since complex numbers with imaginary
part <code>0</code> are automatically converted to real numbers.
</p>
<a name="index-cl_005fR"></a>
<p>The class <code>cl_R</code> comprises real numbers of different kinds. It is an
abstract class.
</p>
<a name="index-cl_005fRA"></a>
<a name="index-rational-number"></a>
<a name="index-integer"></a>
<p>The class <code>cl_RA</code> comprises exact real numbers: rational numbers, including
integers. There is no special class for non-integral rational numbers
since rational numbers with denominator <code>1</code> are automatically converted
to integers.
</p>
<a name="index-cl_005fF"></a>
<p>The class <code>cl_F</code> implements floating-point approximations to real numbers.
It is an abstract class.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Exact-numbers" accesskey="1">Exact numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Floating_002dpoint-numbers" accesskey="2">Floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Complex-numbers" accesskey="3">Complex numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversions" accesskey="4">Conversions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Exact-numbers"></a>
<div class="header">
<p>
Next: <a href="#Floating_002dpoint-numbers" accesskey="n" rel="next">Floating-point numbers</a>, Up: <a href="#Ordinary-number-types" accesskey="u" rel="up">Ordinary number types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exact-numbers-1"></a>
<h3 class="section">3.1 Exact numbers</h3>
<a name="index-exact-number"></a>
<p>Some numbers are represented as exact numbers: there is no loss of information
when such a number is converted from its mathematical value to its internal
representation. On exact numbers, the elementary operations (<code>+</code>,
<code>-</code>, <code>*</code>, <code>/</code>, comparisons, …) compute the completely
correct result.
</p>
<p>In CLN, the exact numbers are:
</p>
<ul>
<li> rational numbers (including integers),
</li><li> complex numbers whose real and imaginary parts are both rational numbers.
</li></ul>
<p>Rational numbers are always normalized to the form
<code><var>numerator</var>/<var>denominator</var></code> where the numerator and denominator
are coprime integers and the denominator is positive. If the resulting
denominator is <code>1</code>, the rational number is converted to an integer.
</p>
<a name="index-immediate-numbers"></a>
<p>Small integers (typically in the range <code>-2^29</code>…<code>2^29-1</code>,
for 32-bit machines) are especially efficient, because they consume no heap
allocation. Otherwise the distinction between these immediate integers
(called “fixnums”) and heap allocated integers (called “bignums”)
is completely transparent.
</p>
<hr>
<a name="Floating_002dpoint-numbers"></a>
<div class="header">
<p>
Next: <a href="#Complex-numbers" accesskey="n" rel="next">Complex numbers</a>, Previous: <a href="#Exact-numbers" accesskey="p" rel="prev">Exact numbers</a>, Up: <a href="#Ordinary-number-types" accesskey="u" rel="up">Ordinary number types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Floating_002dpoint-numbers-1"></a>
<h3 class="section">3.2 Floating-point numbers</h3>
<a name="index-floating_002dpoint-number"></a>
<p>Not all real numbers can be represented exactly. (There is an easy mathematical
proof for this: Only a countable set of numbers can be stored exactly in
a computer, even if one assumes that it has unlimited storage. But there
are uncountably many real numbers.) So some approximation is needed.
CLN implements ordinary floating-point numbers, with mantissa and exponent.
</p>
<a name="index-rounding-error"></a>
<p>The elementary operations (<code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, …)
only return approximate results. For example, the value of the expression
<code>(cl_F) 0.3 + (cl_F) 0.4</code> prints as ‘<samp>0.70000005</samp>’, not as
‘<samp>0.7</samp>’. Rounding errors like this one are inevitable when computing
with floating-point numbers.
</p>
<p>Nevertheless, CLN rounds the floating-point results of the operations <code>+</code>,
<code>-</code>, <code>*</code>, <code>/</code>, <code>sqrt</code> according to the “round-to-even”
rule: It first computes the exact mathematical result and then returns the
floating-point number which is nearest to this. If two floating-point numbers
are equally distant from the ideal result, the one with a <code>0</code> in its least
significant mantissa bit is chosen.
</p>
<p>Similarly, testing floating point numbers for equality ‘<samp>x == y</samp>’
is gambling with random errors. Better check for ‘<samp>abs(x - y) < epsilon</samp>’
for some well-chosen <code>epsilon</code>.
</p>
<p>Floating point numbers come in four flavors:
</p>
<ul>
<li> <a name="index-cl_005fSF"></a>
Short floats, type <code>cl_SF</code>.
They have 1 sign bit, 8 exponent bits (including the exponent’s sign),
and 17 mantissa bits (including the “hidden” bit).
They don’t consume heap allocation.
</li><li> <a name="index-cl_005fFF"></a>
Single floats, type <code>cl_FF</code>.
They have 1 sign bit, 8 exponent bits (including the exponent’s sign),
and 24 mantissa bits (including the “hidden” bit).
In CLN, they are represented as IEEE single-precision floating point numbers.
This corresponds closely to the C/C++ type ‘<samp>float</samp>’.
</li><li> <a name="index-cl_005fDF"></a>
Double floats, type <code>cl_DF</code>.
They have 1 sign bit, 11 exponent bits (including the exponent’s sign),
and 53 mantissa bits (including the “hidden” bit).
In CLN, they are represented as IEEE double-precision floating point numbers.
This corresponds closely to the C/C++ type ‘<samp>double</samp>’.
</li><li> <a name="index-cl_005fLF"></a>
Long floats, type <code>cl_LF</code>.
They have 1 sign bit, 32 exponent bits (including the exponent’s sign),
and n mantissa bits (including the “hidden” bit), where n >= 64.
The precision of a long float is unlimited, but once created, a long float
has a fixed precision. (No “lazy recomputation”.)
</li></ul>
<p>Of course, computations with long floats are more expensive than those
with smaller floating-point formats.
</p>
<p>CLN does not implement features like NaNs, denormalized numbers and
gradual underflow. If the exponent range of some floating-point type
is too limited for your application, choose another floating-point type
with larger exponent range.
</p>
<a name="index-cl_005fF-1"></a>
<p>As a user of CLN, you can forget about the differences between the
four floating-point types and just declare all your floating-point
variables as being of type <code>cl_F</code>. This has the advantage that
when you change the precision of some computation (say, from <code>cl_DF</code>
to <code>cl_LF</code>), you don’t have to change the code, only the precision
of the initial values. Also, many transcendental functions have been
declared as returning a <code>cl_F</code> when the argument is a <code>cl_F</code>,
but such declarations are missing for the types <code>cl_SF</code>, <code>cl_FF</code>,
<code>cl_DF</code>, <code>cl_LF</code>. (Such declarations would be wrong if
the floating point contagion rule happened to change in the future.)
</p>
<hr>
<a name="Complex-numbers"></a>
<div class="header">
<p>
Next: <a href="#Conversions" accesskey="n" rel="next">Conversions</a>, Previous: <a href="#Floating_002dpoint-numbers" accesskey="p" rel="prev">Floating-point numbers</a>, Up: <a href="#Ordinary-number-types" accesskey="u" rel="up">Ordinary number types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Complex-numbers-1"></a>
<h3 class="section">3.3 Complex numbers</h3>
<a name="index-complex-number-1"></a>
<p>Complex numbers, as implemented by the class <code>cl_N</code>, have a real
part and an imaginary part, both real numbers. A complex number whose
imaginary part is the exact number <code>0</code> is automatically converted
to a real number.
</p>
<p>Complex numbers can arise from real numbers alone, for example
through application of <code>sqrt</code> or transcendental functions.
</p>
<hr>
<a name="Conversions"></a>
<div class="header">
<p>
Previous: <a href="#Complex-numbers" accesskey="p" rel="prev">Complex numbers</a>, Up: <a href="#Ordinary-number-types" accesskey="u" rel="up">Ordinary number types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Conversions-1"></a>
<h3 class="section">3.4 Conversions</h3>
<a name="index-conversion"></a>
<p>Conversions from any class to any its superclasses (“base classes” in
C++ terminology) is done automatically.
</p>
<p>Conversions from the C built-in types ‘<samp>long</samp>’ and ‘<samp>unsigned long</samp>’
are provided for the classes <code>cl_I</code>, <code>cl_RA</code>, <code>cl_R</code>,
<code>cl_N</code> and <code>cl_number</code>.
</p>
<p>Conversions from the C built-in types ‘<samp>int</samp>’ and ‘<samp>unsigned int</samp>’
are provided for the classes <code>cl_I</code>, <code>cl_RA</code>, <code>cl_R</code>,
<code>cl_N</code> and <code>cl_number</code>. However, these conversions emphasize
efficiency. On 32-bit systems, their range is therefore limited:
</p>
<ul class="no-bullet">
<li>- The conversion from ‘<samp>int</samp>’ works only if the argument is < 2^29 and >= -2^29.
</li><li>- The conversion from ‘<samp>unsigned int</samp>’ works only if the argument is < 2^29.
</li></ul>
<p>In a declaration like ‘<samp>cl_I x = 10;</samp>’ the C++ compiler is able to
do the conversion of <code>10</code> from ‘<samp>int</samp>’ to ‘<samp>cl_I</samp>’ at compile time
already. On the other hand, code like ‘<samp>cl_I x = 1000000000;</samp>’ is
in error on 32-bit machines.
So, if you want to be sure that an ‘<samp>int</samp>’ whose magnitude is not guaranteed
to be < 2^29 is correctly converted to a ‘<samp>cl_I</samp>’, first convert it to a
‘<samp>long</samp>’. Similarly, if a large ‘<samp>unsigned int</samp>’ is to be converted to a
‘<samp>cl_I</samp>’, first convert it to an ‘<samp>unsigned long</samp>’. On 64-bit machines
there is no such restriction. There, conversions from arbitrary 32-bit ‘<samp>int</samp>’
values always works correctly.
</p>
<p>Conversions from the C built-in type ‘<samp>float</samp>’ are provided for the classes
<code>cl_FF</code>, <code>cl_F</code>, <code>cl_R</code>, <code>cl_N</code> and <code>cl_number</code>.
</p>
<p>Conversions from the C built-in type ‘<samp>double</samp>’ are provided for the classes
<code>cl_DF</code>, <code>cl_F</code>, <code>cl_R</code>, <code>cl_N</code> and <code>cl_number</code>.
</p>
<p>Conversions from ‘<samp>const char *</samp>’ are provided for the classes
<code>cl_I</code>, <code>cl_RA</code>,
<code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>, <code>cl_F</code>,
<code>cl_R</code>, <code>cl_N</code>.
The easiest way to specify a value which is outside of the range of the
C++ built-in types is therefore to specify it as a string, like this:
<a name="index-Rubik_0027s-cube"></a>
</p><div class="example">
<pre class="example"> cl_I order_of_rubiks_cube_group = "43252003274489856000";
</pre></div>
<p>Note that this conversion is done at runtime, not at compile-time.
</p>
<p>Conversions from <code>cl_I</code> to the C built-in types ‘<samp>int</samp>’,
‘<samp>unsigned int</samp>’, ‘<samp>long</samp>’, ‘<samp>unsigned long</samp>’ are provided through
the functions
</p>
<dl compact="compact">
<dt><code>int cl_I_to_int (const cl_I& x)</code></dt>
<dd><a name="index-cl_005fI_005fto_005fint-_0028_0029"></a>
</dd>
<dt><code>unsigned int cl_I_to_uint (const cl_I& x)</code></dt>
<dd><a name="index-cl_005fI_005fto_005fuint-_0028_0029"></a>
</dd>
<dt><code>long cl_I_to_long (const cl_I& x)</code></dt>
<dd><a name="index-cl_005fI_005fto_005flong-_0028_0029"></a>
</dd>
<dt><code>unsigned long cl_I_to_ulong (const cl_I& x)</code></dt>
<dd><a name="index-cl_005fI_005fto_005fulong-_0028_0029"></a>
<p>Returns <code>x</code> as element of the C type <var>ctype</var>. If <code>x</code> is not
representable in the range of <var>ctype</var>, a runtime error occurs.
</p></dd>
</dl>
<p>Conversions from the classes <code>cl_I</code>, <code>cl_RA</code>,
<code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>, <code>cl_F</code> and
<code>cl_R</code>
to the C built-in types ‘<samp>float</samp>’ and ‘<samp>double</samp>’ are provided through
the functions
</p>
<dl compact="compact">
<dt><code>float float_approx (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fapprox-_0028_0029"></a>
</dd>
<dt><code>double double_approx (const <var>type</var>& x)</code></dt>
<dd><a name="index-double_005fapprox-_0028_0029"></a>
<p>Returns an approximation of <code>x</code> of C type <var>ctype</var>.
If <code>abs(x)</code> is too close to 0 (underflow), 0 is returned.
If <code>abs(x)</code> is too large (overflow), an IEEE infinity is returned.
</p></dd>
</dl>
<p>Conversions from any class to any of its subclasses (“derived classes” in
C++ terminology) are not provided. Instead, you can assert and check
that a value belongs to a certain subclass, and return it as element of that
class, using the ‘<samp>As</samp>’ and ‘<samp>The</samp>’ macros.
<a name="index-cast"></a>
<a name="index-As_0028_0029_0028_0029"></a>
<code>As(<var>type</var>)(<var>value</var>)</code> checks that <var>value</var> belongs to
<var>type</var> and returns it as such.
<a name="index-The_0028_0029_0028_0029"></a>
<code>The(<var>type</var>)(<var>value</var>)</code> assumes that <var>value</var> belongs to
<var>type</var> and returns it as such. It is your responsibility to ensure
that this assumption is valid. Since macros and namespaces don’t go
together well, there is an equivalent to ‘<samp>The</samp>’: the template
‘<samp>the</samp>’.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example"> cl_I x = …;
if (!(x >= 0)) abort();
cl_I ten_x_a = The(cl_I)(expt(10,x)); // If x >= 0, 10^x is an integer.
// In general, it would be a rational number.
cl_I ten_x_b = the<cl_I>(expt(10,x)); // The same as above.
</pre></div>
<hr>
<a name="Functions-on-numbers"></a>
<div class="header">
<p>
Next: <a href="#Input_002fOutput" accesskey="n" rel="next">Input/Output</a>, Previous: <a href="#Ordinary-number-types" accesskey="p" rel="prev">Ordinary number types</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-on-numbers-1"></a>
<h2 class="chapter">4 Functions on numbers</h2>
<p>Each of the number classes declares its mathematical operations in the
corresponding include file. For example, if your code operates with
objects of type <code>cl_I</code>, it should <code>#include <cln/integer.h></code>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Constructing-numbers" accesskey="1">Constructing numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-functions" accesskey="2">Elementary functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-rational-functions" accesskey="3">Elementary rational functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Elementary-complex-functions" accesskey="4">Elementary complex functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Comparisons" accesskey="5">Comparisons</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Rounding-functions" accesskey="6">Rounding functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Roots" accesskey="7">Roots</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Transcendental-functions" accesskey="8">Transcendental functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-integers" accesskey="9">Functions on integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversion-functions">Conversion functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Random-number-generators">Random number generators</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Modifying-operators">Modifying operators</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Constructing-numbers"></a>
<div class="header">
<p>
Next: <a href="#Elementary-functions" accesskey="n" rel="next">Elementary functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Constructing-numbers-1"></a>
<h3 class="section">4.1 Constructing numbers</h3>
<p>Here is how to create number objects “from nothing”.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Constructing-integers" accesskey="1">Constructing integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-rational-numbers" accesskey="2">Constructing rational numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-floating_002dpoint-numbers" accesskey="3">Constructing floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Constructing-complex-numbers" accesskey="4">Constructing complex numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Constructing-integers"></a>
<div class="header">
<p>
Next: <a href="#Constructing-rational-numbers" accesskey="n" rel="next">Constructing rational numbers</a>, Up: <a href="#Constructing-numbers" accesskey="u" rel="up">Constructing numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Constructing-integers-1"></a>
<h4 class="subsection">4.1.1 Constructing integers</h4>
<p><code>cl_I</code> objects are most easily constructed from C integers and from
strings. See <a href="#Conversions">Conversions</a>.
</p>
<hr>
<a name="Constructing-rational-numbers"></a>
<div class="header">
<p>
Next: <a href="#Constructing-floating_002dpoint-numbers" accesskey="n" rel="next">Constructing floating-point numbers</a>, Previous: <a href="#Constructing-integers" accesskey="p" rel="prev">Constructing integers</a>, Up: <a href="#Constructing-numbers" accesskey="u" rel="up">Constructing numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Constructing-rational-numbers-1"></a>
<h4 class="subsection">4.1.2 Constructing rational numbers</h4>
<p><code>cl_RA</code> objects can be constructed from strings. The syntax
for rational numbers is described in <a href="#Internal-and-printed-representation">Internal and printed representation</a>.
Another standard way to produce a rational number is through application
of ‘<samp>operator /</samp>’ or ‘<samp>recip</samp>’ on integers.
</p>
<hr>
<a name="Constructing-floating_002dpoint-numbers"></a>
<div class="header">
<p>
Next: <a href="#Constructing-complex-numbers" accesskey="n" rel="next">Constructing complex numbers</a>, Previous: <a href="#Constructing-rational-numbers" accesskey="p" rel="prev">Constructing rational numbers</a>, Up: <a href="#Constructing-numbers" accesskey="u" rel="up">Constructing numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Constructing-floating_002dpoint-numbers-1"></a>
<h4 class="subsection">4.1.3 Constructing floating-point numbers</h4>
<p><code>cl_F</code> objects with low precision are most easily constructed from
C ‘<samp>float</samp>’ and ‘<samp>double</samp>’. See <a href="#Conversions">Conversions</a>.
</p>
<p>To construct a <code>cl_F</code> with high precision, you can use the conversion
from ‘<samp>const char *</samp>’, but you have to specify the desired precision
within the string. (See <a href="#Internal-and-printed-representation">Internal and printed representation</a>.)
Example:
</p><div class="example">
<pre class="example"> cl_F e = "0.271828182845904523536028747135266249775724709369996e+1_40";
</pre></div>
<p>will set ‘<samp>e</samp>’ to the given value, with a precision of 40 decimal digits.
</p>
<p>The programmatic way to construct a <code>cl_F</code> with high precision is
through the <code>cl_float</code> conversion function, see
<a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a>. For example, to compute
<code>e</code> to 40 decimal places, first construct 1.0 to 40 decimal places
and then apply the exponential function:
</p><div class="example">
<pre class="example"> float_format_t precision = float_format(40);
cl_F e = exp(cl_float(1,precision));
</pre></div>
<hr>
<a name="Constructing-complex-numbers"></a>
<div class="header">
<p>
Previous: <a href="#Constructing-floating_002dpoint-numbers" accesskey="p" rel="prev">Constructing floating-point numbers</a>, Up: <a href="#Constructing-numbers" accesskey="u" rel="up">Constructing numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Constructing-complex-numbers-1"></a>
<h4 class="subsection">4.1.4 Constructing complex numbers</h4>
<p>Non-real <code>cl_N</code> objects are normally constructed through the function
</p><div class="example">
<pre class="example"> cl_N complex (const cl_R& realpart, const cl_R& imagpart)
</pre></div>
<p>See <a href="#Elementary-complex-functions">Elementary complex functions</a>.
</p>
<hr>
<a name="Elementary-functions"></a>
<div class="header">
<p>
Next: <a href="#Elementary-rational-functions" accesskey="n" rel="next">Elementary rational functions</a>, Previous: <a href="#Constructing-numbers" accesskey="p" rel="prev">Constructing numbers</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Elementary-functions-1"></a>
<h3 class="section">4.2 Elementary functions</h3>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code><var>type</var> operator + (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002b-_0028_0029"></a>
<p>Addition.
</p>
</dd>
<dt><code><var>type</var> operator - (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002d-_0028_0029"></a>
<p>Subtraction.
</p>
</dd>
<dt><code><var>type</var> operator - (const <var>type</var>&)</code></dt>
<dd><p>Returns the negative of the argument.
</p>
</dd>
<dt><code><var>type</var> plus1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-plus1-_0028_0029"></a>
<p>Returns <code>x + 1</code>.
</p>
</dd>
<dt><code><var>type</var> minus1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-minus1-_0028_0029"></a>
<p>Returns <code>x - 1</code>.
</p>
</dd>
<dt><code><var>type</var> operator * (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002a-_0028_0029"></a>
<p>Multiplication.
</p>
</dd>
<dt><code><var>type</var> square (const <var>type</var>& x)</code></dt>
<dd><a name="index-square-_0028_0029"></a>
<p>Returns <code>x * x</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code><var>type</var> operator / (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002f-_0028_0029"></a>
<p>Division.
</p>
</dd>
<dt><code><var>type</var> recip (const <var>type</var>&)</code></dt>
<dd><a name="index-recip-_0028_0029"></a>
<p>Returns the reciprocal of the argument.
</p></dd>
</dl>
<p>The class <code>cl_I</code> doesn’t define a ‘<samp>/</samp>’ operation because
in the C/C++ language this operator, applied to integral types,
denotes the ‘<samp>floor</samp>’ or ‘<samp>truncate</samp>’ operation (which one of these,
is implementation dependent). (See <a href="#Rounding-functions">Rounding functions</a>.)
Instead, <code>cl_I</code> defines an “exact quotient” function:
</p>
<dl compact="compact">
<dt><code>cl_I exquo (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-exquo-_0028_0029"></a>
<p>Checks that <code>y</code> divides <code>x</code>, and returns the quotient <code>x</code>/<code>y</code>.
</p></dd>
</dl>
<p>The following exponentiation functions are defined:
</p>
<dl compact="compact">
<dt><code>cl_I expt_pos (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-expt_005fpos-_0028_0029"></a>
</dd>
<dt><code>cl_RA expt_pos (const cl_RA& x, const cl_I& y)</code></dt>
<dd><p><code>y</code> must be > 0. Returns <code>x^y</code>.
</p>
</dd>
<dt><code>cl_RA expt (const cl_RA& x, const cl_I& y)</code></dt>
<dd><a name="index-expt-_0028_0029"></a>
</dd>
<dt><code>cl_R expt (const cl_R& x, const cl_I& y)</code></dt>
<dt><code>cl_N expt (const cl_N& x, const cl_I& y)</code></dt>
<dd><p>Returns <code>x^y</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operation:
</p>
<dl compact="compact">
<dt><code><var>type</var> abs (const <var>type</var>& x)</code></dt>
<dd><a name="index-abs-_0028_0029"></a>
<p>Returns the absolute value of <code>x</code>.
This is <code>x</code> if <code>x >= 0</code>, and <code>-x</code> if <code>x <= 0</code>.
</p></dd>
</dl>
<p>The class <code>cl_N</code> implements this as follows:
</p>
<dl compact="compact">
<dt><code>cl_R abs (const cl_N x)</code></dt>
<dd><p>Returns the absolute value of <code>x</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operation:
</p>
<dl compact="compact">
<dt><code><var>type</var> signum (const <var>type</var>& x)</code></dt>
<dd><a name="index-signum-_0028_0029"></a>
<p>Returns the sign of <code>x</code>, in the same number format as <code>x</code>.
This is defined as <code>x / abs(x)</code> if <code>x</code> is non-zero, and
<code>x</code> if <code>x</code> is zero. If <code>x</code> is real, the value is either
0 or 1 or -1.
</p></dd>
</dl>
<hr>
<a name="Elementary-rational-functions"></a>
<div class="header">
<p>
Next: <a href="#Elementary-complex-functions" accesskey="n" rel="next">Elementary complex functions</a>, Previous: <a href="#Elementary-functions" accesskey="p" rel="prev">Elementary functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Elementary-rational-functions-1"></a>
<h3 class="section">4.3 Elementary rational functions</h3>
<p>Each of the classes <code>cl_RA</code>, <code>cl_I</code> defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_I numerator (const <var>type</var>& x)</code></dt>
<dd><a name="index-numerator-_0028_0029"></a>
<p>Returns the numerator of <code>x</code>.
</p>
</dd>
<dt><code>cl_I denominator (const <var>type</var>& x)</code></dt>
<dd><a name="index-denominator-_0028_0029"></a>
<p>Returns the denominator of <code>x</code>.
</p></dd>
</dl>
<p>The numerator and denominator of a rational number are normalized in such
a way that they have no factor in common and the denominator is positive.
</p>
<hr>
<a name="Elementary-complex-functions"></a>
<div class="header">
<p>
Next: <a href="#Comparisons" accesskey="n" rel="next">Comparisons</a>, Previous: <a href="#Elementary-rational-functions" accesskey="p" rel="prev">Elementary rational functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Elementary-complex-functions-1"></a>
<h3 class="section">4.4 Elementary complex functions</h3>
<p>The class <code>cl_N</code> defines the following operation:
</p>
<dl compact="compact">
<dt><code>cl_N complex (const cl_R& a, const cl_R& b)</code></dt>
<dd><a name="index-complex-_0028_0029"></a>
<p>Returns the complex number <code>a+bi</code>, that is, the complex number with
real part <code>a</code> and imaginary part <code>b</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code> defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_R realpart (const <var>type</var>& x)</code></dt>
<dd><a name="index-realpart-_0028_0029"></a>
<p>Returns the real part of <code>x</code>.
</p>
</dd>
<dt><code>cl_R imagpart (const <var>type</var>& x)</code></dt>
<dd><a name="index-imagpart-_0028_0029"></a>
<p>Returns the imaginary part of <code>x</code>.
</p>
</dd>
<dt><code><var>type</var> conjugate (const <var>type</var>& x)</code></dt>
<dd><a name="index-conjugate-_0028_0029"></a>
<p>Returns the complex conjugate of <code>x</code>.
</p></dd>
</dl>
<p>We have the relations
</p>
<ul class="no-bullet">
<li><!-- /@w --> <code>x = complex(realpart(x), imagpart(x))</code>
</li><li><!-- /@w --> <code>conjugate(x) = complex(realpart(x), -imagpart(x))</code>
</li></ul>
<hr>
<a name="Comparisons"></a>
<div class="header">
<p>
Next: <a href="#Rounding-functions" accesskey="n" rel="next">Rounding functions</a>, Previous: <a href="#Elementary-complex-functions" accesskey="p" rel="prev">Elementary complex functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Comparisons-1"></a>
<h3 class="section">4.5 Comparisons</h3>
<a name="index-comparison"></a>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>bool operator == (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003d_003d-_0028_0029"></a>
</dd>
<dt><code>bool operator != (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_0021_003d-_0028_0029"></a>
<p>Comparison, as in C and C++.
</p>
</dd>
<dt><code>uint32 equal_hashcode (const <var>type</var>&)</code></dt>
<dd><a name="index-equal_005fhashcode-_0028_0029"></a>
<p>Returns a 32-bit hash code that is the same for any two numbers which are
the same according to <code>==</code>. This hash code depends on the number’s value,
not its type or precision.
</p>
</dd>
<dt><code>bool zerop (const <var>type</var>& x)</code></dt>
<dd><a name="index-zerop-_0028_0029"></a>
<p>Compare against zero: <code>x == 0</code>
</p></dd>
</dl>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_signean compare (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-compare-_0028_0029"></a>
<p>Compares <code>x</code> and <code>y</code>. Returns +1 if <code>x</code>><code>y</code>,
-1 if <code>x</code><<code>y</code>, 0 if <code>x</code>=<code>y</code>.
</p>
</dd>
<dt><code>bool operator <= (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003c_003d-_0028_0029"></a>
</dd>
<dt><code>bool operator < (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003c-_0028_0029"></a>
</dd>
<dt><code>bool operator >= (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003e_003d-_0028_0029"></a>
</dd>
<dt><code>bool operator > (const <var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003e-_0028_0029"></a>
<p>Comparison, as in C and C++.
</p>
</dd>
<dt><code>bool minusp (const <var>type</var>& x)</code></dt>
<dd><a name="index-minusp-_0028_0029"></a>
<p>Compare against zero: <code>x < 0</code>
</p>
</dd>
<dt><code>bool plusp (const <var>type</var>& x)</code></dt>
<dd><a name="index-plusp-_0028_0029"></a>
<p>Compare against zero: <code>x > 0</code>
</p>
</dd>
<dt><code><var>type</var> max (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-max-_0028_0029"></a>
<p>Return the maximum of <code>x</code> and <code>y</code>.
</p>
</dd>
<dt><code><var>type</var> min (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-min-_0028_0029"></a>
<p>Return the minimum of <code>x</code> and <code>y</code>.
</p></dd>
</dl>
<p>When a floating point number and a rational number are compared, the float
is first converted to a rational number using the function <code>rational</code>.
Since a floating point number actually represents an interval of real numbers,
the result might be surprising.
For example, <code>(cl_F)(cl_R)"1/3" == (cl_R)"1/3"</code> returns false because
there is no floating point number whose value is exactly <code>1/3</code>.
</p>
<hr>
<a name="Rounding-functions"></a>
<div class="header">
<p>
Next: <a href="#Roots" accesskey="n" rel="next">Roots</a>, Previous: <a href="#Comparisons" accesskey="p" rel="prev">Comparisons</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Rounding-functions-1"></a>
<h3 class="section">4.6 Rounding functions</h3>
<a name="index-rounding"></a>
<p>When a real number is to be converted to an integer, there is no “best”
rounding. The desired rounding function depends on the application.
The Common Lisp and ISO Lisp standards offer four rounding functions:
</p>
<dl compact="compact">
<dt><code>floor(x)</code></dt>
<dd><p>This is the largest integer <=<code>x</code>.
</p>
</dd>
<dt><code>ceiling(x)</code></dt>
<dd><p>This is the smallest integer >=<code>x</code>.
</p>
</dd>
<dt><code>truncate(x)</code></dt>
<dd><p>Among the integers between 0 and <code>x</code> (inclusive) the one nearest to <code>x</code>.
</p>
</dd>
<dt><code>round(x)</code></dt>
<dd><p>The integer nearest to <code>x</code>. If <code>x</code> is exactly halfway between two
integers, choose the even one.
</p></dd>
</dl>
<p>These functions have different advantages:
</p>
<p><code>floor</code> and <code>ceiling</code> are translation invariant:
<code>floor(x+n) = floor(x) + n</code> and <code>ceiling(x+n) = ceiling(x) + n</code>
for every <code>x</code> and every integer <code>n</code>.
</p>
<p>On the other hand, <code>truncate</code> and <code>round</code> are symmetric:
<code>truncate(-x) = -truncate(x)</code> and <code>round(-x) = -round(x)</code>,
and furthermore <code>round</code> is unbiased: on the “average”, it rounds
down exactly as often as it rounds up.
</p>
<p>The functions are related like this:
</p>
<ul class="no-bullet">
<li><!-- /@w --> <code>ceiling(m/n) = floor((m+n-1)/n) = floor((m-1)/n)+1</code>
for rational numbers <code>m/n</code> (<code>m</code>, <code>n</code> integers, <code>n</code>>0), and
</li><li><!-- /@w --> <code>truncate(x) = sign(x) * floor(abs(x))</code>
</li></ul>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_I floor1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-floor1-_0028_0029"></a>
<p>Returns <code>floor(x)</code>.
</p></dd>
<dt><code>cl_I ceiling1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-ceiling1-_0028_0029"></a>
<p>Returns <code>ceiling(x)</code>.
</p></dd>
<dt><code>cl_I truncate1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-truncate1-_0028_0029"></a>
<p>Returns <code>truncate(x)</code>.
</p></dd>
<dt><code>cl_I round1 (const <var>type</var>& x)</code></dt>
<dd><a name="index-round1-_0028_0029"></a>
<p>Returns <code>round(x)</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_I floor1 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><p>Returns <code>floor(x/y)</code>.
</p></dd>
<dt><code>cl_I ceiling1 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><p>Returns <code>ceiling(x/y)</code>.
</p></dd>
<dt><code>cl_I truncate1 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><p>Returns <code>truncate(x/y)</code>.
</p></dd>
<dt><code>cl_I round1 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><p>Returns <code>round(x/y)</code>.
</p></dd>
</dl>
<p>These functions are called ‘<samp>floor1</samp>’, … here instead of
‘<samp>floor</samp>’, …, because on some systems, system dependent include
files define ‘<samp>floor</samp>’ and ‘<samp>ceiling</samp>’ as macros.
</p>
<p>In many cases, one needs both the quotient and the remainder of a division.
It is more efficient to compute both at the same time than to perform
two divisions, one for quotient and the next one for the remainder.
The following functions therefore return a structure containing both
the quotient and the remainder. The suffix ‘<samp>2</samp>’ indicates the number
of “return values”. The remainder is defined as follows:
</p>
<ul>
<li> for the computation of <code>quotient = floor(x)</code>,
<code>remainder = x - quotient</code>,
</li><li> for the computation of <code>quotient = floor(x,y)</code>,
<code>remainder = x - quotient*y</code>,
</li></ul>
<p>and similarly for the other three operations.
</p>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>struct <var>type</var>_div_t { cl_I quotient; <var>type</var> remainder; };</code></dt>
<dt><code><var>type</var>_div_t floor2 (const <var>type</var>& x)</code></dt>
<dt><code><var>type</var>_div_t ceiling2 (const <var>type</var>& x)</code></dt>
<dt><code><var>type</var>_div_t truncate2 (const <var>type</var>& x)</code></dt>
<dt><code><var>type</var>_div_t round2 (const <var>type</var>& x)</code></dt>
</dl>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>struct <var>type</var>_div_t { cl_I quotient; <var>type</var> remainder; };</code></dt>
<dt><code><var>type</var>_div_t floor2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-floor2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_div_t ceiling2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-ceiling2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_div_t truncate2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-truncate2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_div_t round2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-round2-_0028_0029"></a>
</dd>
</dl>
<p>Sometimes, one wants the quotient as a floating-point number (of the
same format as the argument, if the argument is a float) instead of as
an integer. The prefix ‘<samp>f</samp>’ indicates this.
</p>
<p>Each of the classes
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code><var>type</var> ffloor (const <var>type</var>& x)</code></dt>
<dd><a name="index-ffloor-_0028_0029"></a>
</dd>
<dt><code><var>type</var> fceiling (const <var>type</var>& x)</code></dt>
<dd><a name="index-fceiling-_0028_0029"></a>
</dd>
<dt><code><var>type</var> ftruncate (const <var>type</var>& x)</code></dt>
<dd><a name="index-ftruncate-_0028_0029"></a>
</dd>
<dt><code><var>type</var> fround (const <var>type</var>& x)</code></dt>
<dd><a name="index-fround-_0028_0029"></a>
</dd>
</dl>
<p>and similarly for class <code>cl_R</code>, but with return type <code>cl_F</code>.
</p>
<p>The class <code>cl_R</code> defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_F ffloor (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code>cl_F fceiling (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code>cl_F ftruncate (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code>cl_F fround (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
</dl>
<p>These functions also exist in versions which return both the quotient
and the remainder. The suffix ‘<samp>2</samp>’ indicates this.
</p>
<p>Each of the classes
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations:
<a name="index-cl_005fF_005ffdiv_005ft"></a>
<a name="index-cl_005fSF_005ffdiv_005ft"></a>
<a name="index-cl_005fFF_005ffdiv_005ft"></a>
<a name="index-cl_005fDF_005ffdiv_005ft"></a>
<a name="index-cl_005fLF_005ffdiv_005ft"></a>
</p>
<dl compact="compact">
<dt><code>struct <var>type</var>_fdiv_t { <var>type</var> quotient; <var>type</var> remainder; };</code></dt>
<dt><code><var>type</var>_fdiv_t ffloor2 (const <var>type</var>& x)</code></dt>
<dd><a name="index-ffloor2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_fdiv_t fceiling2 (const <var>type</var>& x)</code></dt>
<dd><a name="index-fceiling2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_fdiv_t ftruncate2 (const <var>type</var>& x)</code></dt>
<dd><a name="index-ftruncate2-_0028_0029"></a>
</dd>
<dt><code><var>type</var>_fdiv_t fround2 (const <var>type</var>& x)</code></dt>
<dd><a name="index-fround2-_0028_0029"></a>
</dd>
</dl>
<p>and similarly for class <code>cl_R</code>, but with quotient type <code>cl_F</code>.
<a name="index-cl_005fR_005ffdiv_005ft"></a>
</p>
<p>The class <code>cl_R</code> defines the following operations:
</p>
<dl compact="compact">
<dt><code>struct <var>type</var>_fdiv_t { cl_F quotient; cl_R remainder; };</code></dt>
<dt><code><var>type</var>_fdiv_t ffloor2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code><var>type</var>_fdiv_t fceiling2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code><var>type</var>_fdiv_t ftruncate2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dt><code><var>type</var>_fdiv_t fround2 (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
</dl>
<p>Other applications need only the remainder of a division.
The remainder of ‘<samp>floor</samp>’ and ‘<samp>ffloor</samp>’ is called ‘<samp>mod</samp>’
(abbreviation of “modulo”). The remainder ‘<samp>truncate</samp>’ and
‘<samp>ftruncate</samp>’ is called ‘<samp>rem</samp>’ (abbreviation of “remainder”).
</p>
<ul>
<li> <code>mod(x,y) = floor2(x,y).remainder = x - floor(x/y)*y</code>
</li><li> <code>rem(x,y) = truncate2(x,y).remainder = x - truncate(x/y)*y</code>
</li></ul>
<p>If <code>x</code> and <code>y</code> are both >= 0, <code>mod(x,y) = rem(x,y) >= 0</code>.
In general, <code>mod(x,y)</code> has the sign of <code>y</code> or is zero,
and <code>rem(x,y)</code> has the sign of <code>x</code> or is zero.
</p>
<p>The classes <code>cl_R</code>, <code>cl_I</code> define the following operations:
</p>
<dl compact="compact">
<dt><code><var>type</var> mod (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-mod-_0028_0029"></a>
</dd>
<dt><code><var>type</var> rem (const <var>type</var>& x, const <var>type</var>& y)</code></dt>
<dd><a name="index-rem-_0028_0029"></a>
</dd>
</dl>
<hr>
<a name="Roots"></a>
<div class="header">
<p>
Next: <a href="#Transcendental-functions" accesskey="n" rel="next">Transcendental functions</a>, Previous: <a href="#Rounding-functions" accesskey="p" rel="prev">Rounding functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Roots-1"></a>
<h3 class="section">4.7 Roots</h3>
<p>Each of the classes <code>cl_R</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operation:
</p>
<dl compact="compact">
<dt><code><var>type</var> sqrt (const <var>type</var>& x)</code></dt>
<dd><a name="index-sqrt-_0028_0029"></a>
<p><code>x</code> must be >= 0. This function returns the square root of <code>x</code>,
normalized to be >= 0. If <code>x</code> is the square of a rational number,
<code>sqrt(x)</code> will be a rational number, else it will return a
floating-point approximation.
</p></dd>
</dl>
<p>The classes <code>cl_RA</code>, <code>cl_I</code> define the following operation:
</p>
<dl compact="compact">
<dt><code>bool sqrtp (const <var>type</var>& x, <var>type</var>* root)</code></dt>
<dd><a name="index-sqrtp-_0028_0029"></a>
<p>This tests whether <code>x</code> is a perfect square. If so, it returns true
and the exact square root in <code>*root</code>, else it returns false.
</p></dd>
</dl>
<p>Furthermore, for integers, similarly:
</p>
<dl compact="compact">
<dt><code>bool isqrt (const <var>type</var>& x, <var>type</var>* root)</code></dt>
<dd><a name="index-isqrt-_0028_0029"></a>
<p><code>x</code> should be >= 0. This function sets <code>*root</code> to
<code>floor(sqrt(x))</code> and returns the same value as <code>sqrtp</code>:
the boolean value <code>(expt(*root,2) == x)</code>.
</p></dd>
</dl>
<p>For <code>n</code>th roots, the classes <code>cl_RA</code>, <code>cl_I</code>
define the following operation:
</p>
<dl compact="compact">
<dt><code>bool rootp (const <var>type</var>& x, const cl_I& n, <var>type</var>* root)</code></dt>
<dd><a name="index-rootp-_0028_0029"></a>
<p><code>x</code> must be >= 0. <code>n</code> must be > 0.
This tests whether <code>x</code> is an <code>n</code>th power of a rational number.
If so, it returns true and the exact root in <code>*root</code>, else it returns
false.
</p></dd>
</dl>
<p>The only square root function which accepts negative numbers is the one
for class <code>cl_N</code>:
</p>
<dl compact="compact">
<dt><code>cl_N sqrt (const cl_N& z)</code></dt>
<dd><a name="index-sqrt-_0028_0029-1"></a>
<p>Returns the square root of <code>z</code>, as defined by the formula
<code>sqrt(z) = exp(log(z)/2)</code>. Conversion to a floating-point type
or to a complex number are done if necessary. The range of the result is the
right half plane <code>realpart(sqrt(z)) >= 0</code>
including the positive imaginary axis and 0, but excluding
the negative imaginary axis.
The result is an exact number only if <code>z</code> is an exact number.
</p></dd>
</dl>
<hr>
<a name="Transcendental-functions"></a>
<div class="header">
<p>
Next: <a href="#Functions-on-integers" accesskey="n" rel="next">Functions on integers</a>, Previous: <a href="#Roots" accesskey="p" rel="prev">Roots</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Transcendental-functions-1"></a>
<h3 class="section">4.8 Transcendental functions</h3>
<a name="index-transcendental-functions"></a>
<p>The transcendental functions return an exact result if the argument
is exact and the result is exact as well. Otherwise they must return
inexact numbers even if the argument is exact.
For example, <code>cos(0) = 1</code> returns the rational number <code>1</code>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Exponential-and-logarithmic-functions" accesskey="1">Exponential and logarithmic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Trigonometric-functions" accesskey="2">Trigonometric functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Hyperbolic-functions" accesskey="3">Hyperbolic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Euler-gamma" accesskey="4">Euler gamma</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Riemann-zeta" accesskey="5">Riemann zeta</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Exponential-and-logarithmic-functions"></a>
<div class="header">
<p>
Next: <a href="#Trigonometric-functions" accesskey="n" rel="next">Trigonometric functions</a>, Up: <a href="#Transcendental-functions" accesskey="u" rel="up">Transcendental functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exponential-and-logarithmic-functions-1"></a>
<h4 class="subsection">4.8.1 Exponential and logarithmic functions</h4>
<dl compact="compact">
<dt><code>cl_R exp (const cl_R& x)</code></dt>
<dd><a name="index-exp-_0028_0029"></a>
</dd>
<dt><code>cl_N exp (const cl_N& x)</code></dt>
<dd><p>Returns the exponential function of <code>x</code>. This is <code>e^x</code> where
<code>e</code> is the base of the natural logarithms. The range of the result
is the entire complex plane excluding 0.
</p>
</dd>
<dt><code>cl_R ln (const cl_R& x)</code></dt>
<dd><a name="index-ln-_0028_0029"></a>
<p><code>x</code> must be > 0. Returns the (natural) logarithm of x.
</p>
</dd>
<dt><code>cl_N log (const cl_N& x)</code></dt>
<dd><a name="index-log-_0028_0029"></a>
<p>Returns the (natural) logarithm of x. If <code>x</code> is real and positive,
this is <code>ln(x)</code>. In general, <code>log(x) = log(abs(x)) + i*phase(x)</code>.
The range of the result is the strip in the complex plane
<code>-pi < imagpart(log(x)) <= pi</code>.
</p>
</dd>
<dt><code>cl_R phase (const cl_N& x)</code></dt>
<dd><a name="index-phase-_0028_0029"></a>
<p>Returns the angle part of <code>x</code> in its polar representation as a
complex number. That is, <code>phase(x) = atan(realpart(x),imagpart(x))</code>.
This is also the imaginary part of <code>log(x)</code>.
The range of the result is the interval <code>-pi < phase(x) <= pi</code>.
The result will be an exact number only if <code>zerop(x)</code> or
if <code>x</code> is real and positive.
</p>
</dd>
<dt><code>cl_R log (const cl_R& a, const cl_R& b)</code></dt>
<dd><p><code>a</code> and <code>b</code> must be > 0. Returns the logarithm of <code>a</code> with
respect to base <code>b</code>. <code>log(a,b) = ln(a)/ln(b)</code>.
The result can be exact only if <code>a = 1</code> or if <code>a</code> and <code>b</code>
are both rational.
</p>
</dd>
<dt><code>cl_N log (const cl_N& a, const cl_N& b)</code></dt>
<dd><p>Returns the logarithm of <code>a</code> with respect to base <code>b</code>.
<code>log(a,b) = log(a)/log(b)</code>.
</p>
</dd>
<dt><code>cl_N expt (const cl_N& x, const cl_N& y)</code></dt>
<dd><a name="index-expt-_0028_0029-1"></a>
<p>Exponentiation: Returns <code>x^y = exp(y*log(x))</code>.
</p></dd>
</dl>
<p>The constant e = exp(1) = 2.71828… is returned by the following functions:
</p>
<dl compact="compact">
<dt><code>cl_F exp1 (float_format_t f)</code></dt>
<dd><a name="index-exp1-_0028_0029"></a>
<p>Returns e as a float of format <code>f</code>.
</p>
</dd>
<dt><code>cl_F exp1 (const cl_F& y)</code></dt>
<dd><p>Returns e in the float format of <code>y</code>.
</p>
</dd>
<dt><code>cl_F exp1 (void)</code></dt>
<dd><p>Returns e as a float of format <code>default_float_format</code>.
</p></dd>
</dl>
<hr>
<a name="Trigonometric-functions"></a>
<div class="header">
<p>
Next: <a href="#Hyperbolic-functions" accesskey="n" rel="next">Hyperbolic functions</a>, Previous: <a href="#Exponential-and-logarithmic-functions" accesskey="p" rel="prev">Exponential and logarithmic functions</a>, Up: <a href="#Transcendental-functions" accesskey="u" rel="up">Transcendental functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Trigonometric-functions-1"></a>
<h4 class="subsection">4.8.2 Trigonometric functions</h4>
<dl compact="compact">
<dt><code>cl_R sin (const cl_R& x)</code></dt>
<dd><a name="index-sin-_0028_0029"></a>
<p>Returns <code>sin(x)</code>. The range of the result is the interval
<code>-1 <= sin(x) <= 1</code>.
</p>
</dd>
<dt><code>cl_N sin (const cl_N& z)</code></dt>
<dd><p>Returns <code>sin(z)</code>. The range of the result is the entire complex plane.
</p>
</dd>
<dt><code>cl_R cos (const cl_R& x)</code></dt>
<dd><a name="index-cos-_0028_0029"></a>
<p>Returns <code>cos(x)</code>. The range of the result is the interval
<code>-1 <= cos(x) <= 1</code>.
</p>
</dd>
<dt><code>cl_N cos (const cl_N& x)</code></dt>
<dd><p>Returns <code>cos(z)</code>. The range of the result is the entire complex plane.
</p>
</dd>
<dt><code>struct cos_sin_t { cl_R cos; cl_R sin; };</code></dt>
<dd><a name="index-cos_005fsin_005ft"></a>
</dd>
<dt><code>cos_sin_t cos_sin (const cl_R& x)</code></dt>
<dd><p>Returns both <code>sin(x)</code> and <code>cos(x)</code>. This is more efficient than
<a name="index-cos_005fsin-_0028_0029"></a>
computing them separately. The relation <code>cos^2 + sin^2 = 1</code> will
hold only approximately.
</p>
</dd>
<dt><code>cl_R tan (const cl_R& x)</code></dt>
<dd><a name="index-tan-_0028_0029"></a>
</dd>
<dt><code>cl_N tan (const cl_N& x)</code></dt>
<dd><p>Returns <code>tan(x) = sin(x)/cos(x)</code>.
</p>
</dd>
<dt><code>cl_N cis (const cl_R& x)</code></dt>
<dd><a name="index-cis-_0028_0029"></a>
</dd>
<dt><code>cl_N cis (const cl_N& x)</code></dt>
<dd><p>Returns <code>exp(i*x)</code>. The name ‘<samp>cis</samp>’ means “cos + i sin”, because
<code>e^(i*x) = cos(x) + i*sin(x)</code>.
</p>
<a name="index-asin"></a>
<a name="index-asin-_0028_0029"></a>
</dd>
<dt><code>cl_N asin (const cl_N& z)</code></dt>
<dd><p>Returns <code>arcsin(z)</code>. This is defined as
<code>arcsin(z) = log(iz+sqrt(1-z^2))/i</code> and satisfies
<code>arcsin(-z) = -arcsin(z)</code>.
The range of the result is the strip in the complex domain
<code>-pi/2 <= realpart(arcsin(z)) <= pi/2</code>, excluding the numbers
with <code>realpart = -pi/2</code> and <code>imagpart < 0</code> and the numbers
with <code>realpart = pi/2</code> and <code>imagpart > 0</code>.
</p>
</dd>
<dt><code>cl_N acos (const cl_N& z)</code></dt>
<dd><a name="index-acos-_0028_0029"></a>
<p>Returns <code>arccos(z)</code>. This is defined as
<code>arccos(z) = pi/2 - arcsin(z) = log(z+i*sqrt(1-z^2))/i</code>
and satisfies <code>arccos(-z) = pi - arccos(z)</code>.
The range of the result is the strip in the complex domain
<code>0 <= realpart(arcsin(z)) <= pi</code>, excluding the numbers
with <code>realpart = 0</code> and <code>imagpart < 0</code> and the numbers
with <code>realpart = pi</code> and <code>imagpart > 0</code>.
</p>
<a name="index-atan"></a>
<a name="index-atan-_0028_0029"></a>
</dd>
<dt><code>cl_R atan (const cl_R& x, const cl_R& y)</code></dt>
<dd><p>Returns the angle of the polar representation of the complex number
<code>x+iy</code>. This is <code>atan(y/x)</code> if <code>x>0</code>. The range of
the result is the interval <code>-pi < atan(x,y) <= pi</code>. The result will
be an exact number only if <code>x > 0</code> and <code>y</code> is the exact <code>0</code>.
WARNING: In Common Lisp, this function is called as <code>(atan y x)</code>,
with reversed order of arguments.
</p>
</dd>
<dt><code>cl_R atan (const cl_R& x)</code></dt>
<dd><p>Returns <code>arctan(x)</code>. This is the same as <code>atan(1,x)</code>. The range
of the result is the interval <code>-pi/2 < atan(x) < pi/2</code>. The result
will be an exact number only if <code>x</code> is the exact <code>0</code>.
</p>
</dd>
<dt><code>cl_N atan (const cl_N& z)</code></dt>
<dd><p>Returns <code>arctan(z)</code>. This is defined as
<code>arctan(z) = (log(1+iz)-log(1-iz)) / 2i</code> and satisfies
<code>arctan(-z) = -arctan(z)</code>. The range of the result is
the strip in the complex domain
<code>-pi/2 <= realpart(arctan(z)) <= pi/2</code>, excluding the numbers
with <code>realpart = -pi/2</code> and <code>imagpart >= 0</code> and the numbers
with <code>realpart = pi/2</code> and <code>imagpart <= 0</code>.
</p>
</dd>
</dl>
<a name="index-pi"></a>
<a name="index-Archimedes_0027-constant"></a>
<p>Archimedes’ constant pi = 3.14… is returned by the following functions:
</p>
<dl compact="compact">
<dt><code>cl_F pi (float_format_t f)</code></dt>
<dd><a name="index-pi-_0028_0029"></a>
<p>Returns pi as a float of format <code>f</code>.
</p>
</dd>
<dt><code>cl_F pi (const cl_F& y)</code></dt>
<dd><p>Returns pi in the float format of <code>y</code>.
</p>
</dd>
<dt><code>cl_F pi (void)</code></dt>
<dd><p>Returns pi as a float of format <code>default_float_format</code>.
</p></dd>
</dl>
<hr>
<a name="Hyperbolic-functions"></a>
<div class="header">
<p>
Next: <a href="#Euler-gamma" accesskey="n" rel="next">Euler gamma</a>, Previous: <a href="#Trigonometric-functions" accesskey="p" rel="prev">Trigonometric functions</a>, Up: <a href="#Transcendental-functions" accesskey="u" rel="up">Transcendental functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Hyperbolic-functions-1"></a>
<h4 class="subsection">4.8.3 Hyperbolic functions</h4>
<dl compact="compact">
<dt><code>cl_R sinh (const cl_R& x)</code></dt>
<dd><a name="index-sinh-_0028_0029"></a>
<p>Returns <code>sinh(x)</code>.
</p>
</dd>
<dt><code>cl_N sinh (const cl_N& z)</code></dt>
<dd><p>Returns <code>sinh(z)</code>. The range of the result is the entire complex plane.
</p>
</dd>
<dt><code>cl_R cosh (const cl_R& x)</code></dt>
<dd><a name="index-cosh-_0028_0029"></a>
<p>Returns <code>cosh(x)</code>. The range of the result is the interval
<code>cosh(x) >= 1</code>.
</p>
</dd>
<dt><code>cl_N cosh (const cl_N& z)</code></dt>
<dd><p>Returns <code>cosh(z)</code>. The range of the result is the entire complex plane.
</p>
</dd>
<dt><code>struct cosh_sinh_t { cl_R cosh; cl_R sinh; };</code></dt>
<dd><a name="index-cosh_005fsinh_005ft"></a>
</dd>
<dt><code>cosh_sinh_t cosh_sinh (const cl_R& x)</code></dt>
<dd><a name="index-cosh_005fsinh-_0028_0029"></a>
<p>Returns both <code>sinh(x)</code> and <code>cosh(x)</code>. This is more efficient than
computing them separately. The relation <code>cosh^2 - sinh^2 = 1</code> will
hold only approximately.
</p>
</dd>
<dt><code>cl_R tanh (const cl_R& x)</code></dt>
<dd><a name="index-tanh-_0028_0029"></a>
</dd>
<dt><code>cl_N tanh (const cl_N& x)</code></dt>
<dd><p>Returns <code>tanh(x) = sinh(x)/cosh(x)</code>.
</p>
</dd>
<dt><code>cl_N asinh (const cl_N& z)</code></dt>
<dd><a name="index-asinh-_0028_0029"></a>
<p>Returns <code>arsinh(z)</code>. This is defined as
<code>arsinh(z) = log(z+sqrt(1+z^2))</code> and satisfies
<code>arsinh(-z) = -arsinh(z)</code>.
The range of the result is the strip in the complex domain
<code>-pi/2 <= imagpart(arsinh(z)) <= pi/2</code>, excluding the numbers
with <code>imagpart = -pi/2</code> and <code>realpart > 0</code> and the numbers
with <code>imagpart = pi/2</code> and <code>realpart < 0</code>.
</p>
</dd>
<dt><code>cl_N acosh (const cl_N& z)</code></dt>
<dd><a name="index-acosh-_0028_0029"></a>
<p>Returns <code>arcosh(z)</code>. This is defined as
<code>arcosh(z) = 2*log(sqrt((z+1)/2)+sqrt((z-1)/2))</code>.
The range of the result is the half-strip in the complex domain
<code>-pi < imagpart(arcosh(z)) <= pi, realpart(arcosh(z)) >= 0</code>,
excluding the numbers with <code>realpart = 0</code> and <code>-pi < imagpart < 0</code>.
</p>
</dd>
<dt><code>cl_N atanh (const cl_N& z)</code></dt>
<dd><a name="index-atanh-_0028_0029"></a>
<p>Returns <code>artanh(z)</code>. This is defined as
<code>artanh(z) = (log(1+z)-log(1-z)) / 2</code> and satisfies
<code>artanh(-z) = -artanh(z)</code>. The range of the result is
the strip in the complex domain
<code>-pi/2 <= imagpart(artanh(z)) <= pi/2</code>, excluding the numbers
with <code>imagpart = -pi/2</code> and <code>realpart <= 0</code> and the numbers
with <code>imagpart = pi/2</code> and <code>realpart >= 0</code>.
</p></dd>
</dl>
<hr>
<a name="Euler-gamma"></a>
<div class="header">
<p>
Next: <a href="#Riemann-zeta" accesskey="n" rel="next">Riemann zeta</a>, Previous: <a href="#Hyperbolic-functions" accesskey="p" rel="prev">Hyperbolic functions</a>, Up: <a href="#Transcendental-functions" accesskey="u" rel="up">Transcendental functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Euler-gamma-1"></a>
<h4 class="subsection">4.8.4 Euler gamma</h4>
<a name="index-Euler_0027s-constant"></a>
<p>Euler’s constant C = 0.577… is returned by the following functions:
</p>
<dl compact="compact">
<dt><code>cl_F eulerconst (float_format_t f)</code></dt>
<dd><a name="index-eulerconst-_0028_0029"></a>
<p>Returns Euler’s constant as a float of format <code>f</code>.
</p>
</dd>
<dt><code>cl_F eulerconst (const cl_F& y)</code></dt>
<dd><p>Returns Euler’s constant in the float format of <code>y</code>.
</p>
</dd>
<dt><code>cl_F eulerconst (void)</code></dt>
<dd><p>Returns Euler’s constant as a float of format <code>default_float_format</code>.
</p></dd>
</dl>
<p>Catalan’s constant G = 0.915… is returned by the following functions:
<a name="index-Catalan_0027s-constant"></a>
</p>
<dl compact="compact">
<dt><code>cl_F catalanconst (float_format_t f)</code></dt>
<dd><a name="index-catalanconst-_0028_0029"></a>
<p>Returns Catalan’s constant as a float of format <code>f</code>.
</p>
</dd>
<dt><code>cl_F catalanconst (const cl_F& y)</code></dt>
<dd><p>Returns Catalan’s constant in the float format of <code>y</code>.
</p>
</dd>
<dt><code>cl_F catalanconst (void)</code></dt>
<dd><p>Returns Catalan’s constant as a float of format <code>default_float_format</code>.
</p></dd>
</dl>
<hr>
<a name="Riemann-zeta"></a>
<div class="header">
<p>
Previous: <a href="#Euler-gamma" accesskey="p" rel="prev">Euler gamma</a>, Up: <a href="#Transcendental-functions" accesskey="u" rel="up">Transcendental functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Riemann-zeta-1"></a>
<h4 class="subsection">4.8.5 Riemann zeta</h4>
<a name="index-Riemann_0027s-zeta"></a>
<p>Riemann’s zeta function at an integral point <code>s>1</code> is returned by the
following functions:
</p>
<dl compact="compact">
<dt><code>cl_F zeta (int s, float_format_t f)</code></dt>
<dd><a name="index-zeta-_0028_0029"></a>
<p>Returns Riemann’s zeta function at <code>s</code> as a float of format <code>f</code>.
</p>
</dd>
<dt><code>cl_F zeta (int s, const cl_F& y)</code></dt>
<dd><p>Returns Riemann’s zeta function at <code>s</code> in the float format of <code>y</code>.
</p>
</dd>
<dt><code>cl_F zeta (int s)</code></dt>
<dd><p>Returns Riemann’s zeta function at <code>s</code> as a float of format
<code>default_float_format</code>.
</p></dd>
</dl>
<hr>
<a name="Functions-on-integers"></a>
<div class="header">
<p>
Next: <a href="#Functions-on-floating_002dpoint-numbers" accesskey="n" rel="next">Functions on floating-point numbers</a>, Previous: <a href="#Transcendental-functions" accesskey="p" rel="prev">Transcendental functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-on-integers-1"></a>
<h3 class="section">4.9 Functions on integers</h3>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Logical-functions" accesskey="1">Logical functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Number-theoretic-functions" accesskey="2">Number theoretic functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Combinatorial-functions" accesskey="3">Combinatorial functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Logical-functions"></a>
<div class="header">
<p>
Next: <a href="#Number-theoretic-functions" accesskey="n" rel="next">Number theoretic functions</a>, Up: <a href="#Functions-on-integers" accesskey="u" rel="up">Functions on integers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Logical-functions-1"></a>
<h4 class="subsection">4.9.1 Logical functions</h4>
<p>Integers, when viewed as in two’s complement notation, can be thought as
infinite bit strings where the bits’ values eventually are constant.
For example,
</p><div class="example">
<pre class="example"> 17 = ......00010001
-6 = ......11111010
</pre></div>
<p>The logical operations view integers as such bit strings and operate
on each of the bit positions in parallel.
</p>
<dl compact="compact">
<dt><code>cl_I lognot (const cl_I& x)</code></dt>
<dd><a name="index-lognot-_0028_0029"></a>
</dd>
<dt><code>cl_I operator ~ (const cl_I& x)</code></dt>
<dd><a name="index-operator-_007e-_0028_0029"></a>
<p>Logical not, like <code>~x</code> in C. This is the same as <code>-1-x</code>.
</p>
</dd>
<dt><code>cl_I logand (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logand-_0028_0029"></a>
</dd>
<dt><code>cl_I operator & (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-operator-_0026-_0028_0029"></a>
<p>Logical and, like <code>x & y</code> in C.
</p>
</dd>
<dt><code>cl_I logior (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logior-_0028_0029"></a>
</dd>
<dt><code>cl_I operator | (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-operator-_007c-_0028_0029"></a>
<p>Logical (inclusive) or, like <code>x | y</code> in C.
</p>
</dd>
<dt><code>cl_I logxor (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logxor-_0028_0029"></a>
</dd>
<dt><code>cl_I operator ^ (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-operator-_005e-_0028_0029"></a>
<p>Exclusive or, like <code>x ^ y</code> in C.
</p>
</dd>
<dt><code>cl_I logeqv (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logeqv-_0028_0029"></a>
<p>Bitwise equivalence, like <code>~(x ^ y)</code> in C.
</p>
</dd>
<dt><code>cl_I lognand (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-lognand-_0028_0029"></a>
<p>Bitwise not and, like <code>~(x & y)</code> in C.
</p>
</dd>
<dt><code>cl_I lognor (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-lognor-_0028_0029"></a>
<p>Bitwise not or, like <code>~(x | y)</code> in C.
</p>
</dd>
<dt><code>cl_I logandc1 (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logandc1-_0028_0029"></a>
<p>Logical and, complementing the first argument, like <code>~x & y</code> in C.
</p>
</dd>
<dt><code>cl_I logandc2 (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logandc2-_0028_0029"></a>
<p>Logical and, complementing the second argument, like <code>x & ~y</code> in C.
</p>
</dd>
<dt><code>cl_I logorc1 (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logorc1-_0028_0029"></a>
<p>Logical or, complementing the first argument, like <code>~x | y</code> in C.
</p>
</dd>
<dt><code>cl_I logorc2 (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logorc2-_0028_0029"></a>
<p>Logical or, complementing the second argument, like <code>x | ~y</code> in C.
</p></dd>
</dl>
<p>These operations are all available though the function
</p><dl compact="compact">
<dt><code>cl_I boole (cl_boole op, const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-boole-_0028_0029"></a>
</dd>
</dl>
<p>where <code>op</code> must have one of the 16 values (each one stands for a function
which combines two bits into one bit): <code>boole_clr</code>, <code>boole_set</code>,
<code>boole_1</code>, <code>boole_2</code>, <code>boole_c1</code>, <code>boole_c2</code>,
<code>boole_and</code>, <code>boole_ior</code>, <code>boole_xor</code>, <code>boole_eqv</code>,
<code>boole_nand</code>, <code>boole_nor</code>, <code>boole_andc1</code>, <code>boole_andc2</code>,
<code>boole_orc1</code>, <code>boole_orc2</code>.
<a name="index-boole_005fclr"></a>
<a name="index-boole_005fset"></a>
<a name="index-boole_005f1"></a>
<a name="index-boole_005f2"></a>
<a name="index-boole_005fc1"></a>
<a name="index-boole_005fc2"></a>
<a name="index-boole_005fand"></a>
<a name="index-boole_005fxor"></a>
<a name="index-boole_005feqv"></a>
<a name="index-boole_005fnand"></a>
<a name="index-boole_005fnor"></a>
<a name="index-boole_005fandc1"></a>
<a name="index-boole_005fandc2"></a>
<a name="index-boole_005forc1"></a>
<a name="index-boole_005forc2"></a>
</p>
<p>Other functions that view integers as bit strings:
</p>
<dl compact="compact">
<dt><code>bool logtest (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-logtest-_0028_0029"></a>
<p>Returns true if some bit is set in both <code>x</code> and <code>y</code>, i.e. if
<code>logand(x,y) != 0</code>.
</p>
</dd>
<dt><code>bool logbitp (const cl_I& n, const cl_I& x)</code></dt>
<dd><a name="index-logbitp-_0028_0029"></a>
<p>Returns true if the <code>n</code>th bit (from the right) of <code>x</code> is set.
Bit 0 is the least significant bit.
</p>
</dd>
<dt><code>uintC logcount (const cl_I& x)</code></dt>
<dd><a name="index-logcount-_0028_0029"></a>
<p>Returns the number of one bits in <code>x</code>, if <code>x</code> >= 0, or
the number of zero bits in <code>x</code>, if <code>x</code> < 0.
</p></dd>
</dl>
<p>The following functions operate on intervals of bits in integers.
The type
</p><div class="example">
<pre class="example">struct cl_byte { uintC size; uintC position; };
</pre></div>
<a name="index-cl_005fbyte"></a>
<p>represents the bit interval containing the bits
<code>position</code>…<code>position+size-1</code> of an integer.
The constructor <code>cl_byte(size,position)</code> constructs a <code>cl_byte</code>.
</p>
<dl compact="compact">
<dt><code>cl_I ldb (const cl_I& n, const cl_byte& b)</code></dt>
<dd><a name="index-ldb-_0028_0029"></a>
<p>extracts the bits of <code>n</code> described by the bit interval <code>b</code>
and returns them as a nonnegative integer with <code>b.size</code> bits.
</p>
</dd>
<dt><code>bool ldb_test (const cl_I& n, const cl_byte& b)</code></dt>
<dd><a name="index-ldb_005ftest-_0028_0029"></a>
<p>Returns true if some bit described by the bit interval <code>b</code> is set in
<code>n</code>.
</p>
</dd>
<dt><code>cl_I dpb (const cl_I& newbyte, const cl_I& n, const cl_byte& b)</code></dt>
<dd><a name="index-dpb-_0028_0029"></a>
<p>Returns <code>n</code>, with the bits described by the bit interval <code>b</code>
replaced by <code>newbyte</code>. Only the lowest <code>b.size</code> bits of
<code>newbyte</code> are relevant.
</p></dd>
</dl>
<p>The functions <code>ldb</code> and <code>dpb</code> implicitly shift. The following
functions are their counterparts without shifting:
</p>
<dl compact="compact">
<dt><code>cl_I mask_field (const cl_I& n, const cl_byte& b)</code></dt>
<dd><a name="index-mask_005ffield-_0028_0029"></a>
<p>returns an integer with the bits described by the bit interval <code>b</code>
copied from the corresponding bits in <code>n</code>, the other bits zero.
</p>
</dd>
<dt><code>cl_I deposit_field (const cl_I& newbyte, const cl_I& n, const cl_byte& b)</code></dt>
<dd><a name="index-deposit_005ffield-_0028_0029"></a>
<p>returns an integer where the bits described by the bit interval <code>b</code>
come from <code>newbyte</code> and the other bits come from <code>n</code>.
</p></dd>
</dl>
<p>The following relations hold:
</p>
<ul class="no-bullet">
<li><!-- /@w --> <code>ldb (n, b) = mask_field(n, b) >> b.position</code>,
</li><li><!-- /@w --> <code>dpb (newbyte, n, b) = deposit_field (newbyte << b.position, n, b)</code>,
</li><li><!-- /@w --> <code>deposit_field(newbyte,n,b) = n ^ mask_field(n,b) ^ mask_field(new_byte,b)</code>.
</li></ul>
<p>The following operations on integers as bit strings are efficient shortcuts
for common arithmetic operations:
</p>
<dl compact="compact">
<dt><code>bool oddp (const cl_I& x)</code></dt>
<dd><a name="index-oddp-_0028_0029"></a>
<p>Returns true if the least significant bit of <code>x</code> is 1. Equivalent to
<code>mod(x,2) != 0</code>.
</p>
</dd>
<dt><code>bool evenp (const cl_I& x)</code></dt>
<dd><a name="index-evenp-_0028_0029"></a>
<p>Returns true if the least significant bit of <code>x</code> is 0. Equivalent to
<code>mod(x,2) == 0</code>.
</p>
</dd>
<dt><code>cl_I operator << (const cl_I& x, const cl_I& n)</code></dt>
<dd><a name="index-operator-_003c_003c-_0028_0029"></a>
<p>Shifts <code>x</code> by <code>n</code> bits to the left. <code>n</code> should be >=0.
Equivalent to <code>x * expt(2,n)</code>.
</p>
</dd>
<dt><code>cl_I operator >> (const cl_I& x, const cl_I& n)</code></dt>
<dd><a name="index-operator-_003e_003e-_0028_0029"></a>
<p>Shifts <code>x</code> by <code>n</code> bits to the right. <code>n</code> should be >=0.
Bits shifted out to the right are thrown away.
Equivalent to <code>floor(x / expt(2,n))</code>.
</p>
</dd>
<dt><code>cl_I ash (const cl_I& x, const cl_I& y)</code></dt>
<dd><a name="index-ash-_0028_0029"></a>
<p>Shifts <code>x</code> by <code>y</code> bits to the left (if <code>y</code>>=0) or
by <code>-y</code> bits to the right (if <code>y</code><=0). In other words, this
returns <code>floor(x * expt(2,y))</code>.
</p>
</dd>
<dt><code>uintC integer_length (const cl_I& x)</code></dt>
<dd><a name="index-integer_005flength-_0028_0029"></a>
<p>Returns the number of bits (excluding the sign bit) needed to represent <code>x</code>
in two’s complement notation. This is the smallest n >= 0 such that
-2^n <= x < 2^n. If x > 0, this is the unique n > 0 such that
2^(n-1) <= x < 2^n.
</p>
</dd>
<dt><code>uintC ord2 (const cl_I& x)</code></dt>
<dd><a name="index-ord2-_0028_0029"></a>
<p><code>x</code> must be non-zero. This function returns the number of 0 bits at the
right of <code>x</code> in two’s complement notation. This is the largest n >= 0
such that 2^n divides <code>x</code>.
</p>
</dd>
<dt><code>uintC power2p (const cl_I& x)</code></dt>
<dd><a name="index-power2p-_0028_0029"></a>
<p><code>x</code> must be > 0. This function checks whether <code>x</code> is a power of 2.
If <code>x</code> = 2^(n-1), it returns n. Else it returns 0.
(See also the function <code>logp</code>.)
</p></dd>
</dl>
<hr>
<a name="Number-theoretic-functions"></a>
<div class="header">
<p>
Next: <a href="#Combinatorial-functions" accesskey="n" rel="next">Combinatorial functions</a>, Previous: <a href="#Logical-functions" accesskey="p" rel="prev">Logical functions</a>, Up: <a href="#Functions-on-integers" accesskey="u" rel="up">Functions on integers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Number-theoretic-functions-1"></a>
<h4 class="subsection">4.9.2 Number theoretic functions</h4>
<dl compact="compact">
<dt><code>uint32 gcd (unsigned long a, unsigned long b)</code></dt>
<dd><a name="index-gcd-_0028_0029"></a>
</dd>
<dt><code>cl_I gcd (const cl_I& a, const cl_I& b)</code></dt>
<dd><p>This function returns the greatest common divisor of <code>a</code> and <code>b</code>,
normalized to be >= 0.
</p>
</dd>
<dt><code>cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)</code></dt>
<dd><a name="index-xgcd-_0028_0029"></a>
<p>This function (“extended gcd”) returns the greatest common divisor <code>g</code> of
<code>a</code> and <code>b</code> and at the same time the representation of <code>g</code>
as an integral linear combination of <code>a</code> and <code>b</code>:
<code>u</code> and <code>v</code> with <code>u*a+v*b = g</code>, <code>g</code> >= 0.
<code>u</code> and <code>v</code> will be normalized to be of smallest possible absolute
value, in the following sense: If <code>a</code> and <code>b</code> are non-zero, and
<code>abs(a) != abs(b)</code>, <code>u</code> and <code>v</code> will satisfy the inequalities
<code>abs(u) <= abs(b)/(2*g)</code>, <code>abs(v) <= abs(a)/(2*g)</code>.
</p>
</dd>
<dt><code>cl_I lcm (const cl_I& a, const cl_I& b)</code></dt>
<dd><a name="index-lcm-_0028_0029"></a>
<p>This function returns the least common multiple of <code>a</code> and <code>b</code>,
normalized to be >= 0.
</p>
</dd>
<dt><code>bool logp (const cl_I& a, const cl_I& b, cl_RA* l)</code></dt>
<dd><a name="index-logp-_0028_0029"></a>
</dd>
<dt><code>bool logp (const cl_RA& a, const cl_RA& b, cl_RA* l)</code></dt>
<dd><p><code>a</code> must be > 0. <code>b</code> must be >0 and != 1. If log(a,b) is
rational number, this function returns true and sets *l = log(a,b), else
it returns false.
</p>
</dd>
<dt><code>int jacobi (signed long a, signed long b)</code></dt>
<dd><a name="index-jacobi_0028_0029"></a>
</dd>
<dt><code>int jacobi (const cl_I& a, const cl_I& b)</code></dt>
<dd><p>Returns the Jacobi symbol
(a/b),
<code>a,b</code> must be integers, <code>b>0</code> and odd. The result is 0
iff gcd(a,b)>1.
</p>
</dd>
<dt><code>bool isprobprime (const cl_I& n)</code></dt>
<dd><a name="index-prime"></a>
<a name="index-isprobprime_0028_0029"></a>
<p>Returns true if <code>n</code> is a small prime or passes the Miller-Rabin
primality test. The probability of a false positive is 1:10^30.
</p>
</dd>
<dt><code>cl_I nextprobprime (const cl_R& x)</code></dt>
<dd><a name="index-nextprobprime_0028_0029"></a>
<p>Returns the smallest probable prime >=<code>x</code>.
</p></dd>
</dl>
<hr>
<a name="Combinatorial-functions"></a>
<div class="header">
<p>
Previous: <a href="#Number-theoretic-functions" accesskey="p" rel="prev">Number theoretic functions</a>, Up: <a href="#Functions-on-integers" accesskey="u" rel="up">Functions on integers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Combinatorial-functions-1"></a>
<h4 class="subsection">4.9.3 Combinatorial functions</h4>
<dl compact="compact">
<dt><code>cl_I factorial (uintL n)</code></dt>
<dd><a name="index-factorial-_0028_0029"></a>
<p><code>n</code> must be a small integer >= 0. This function returns the factorial
<code>n</code>! = <code>1*2*…*n</code>.
</p>
</dd>
<dt><code>cl_I doublefactorial (uintL n)</code></dt>
<dd><a name="index-doublefactorial-_0028_0029"></a>
<p><code>n</code> must be a small integer >= 0. This function returns the
doublefactorial <code>n</code>!! = <code>1*3*…*n</code> or
<code>n</code>!! = <code>2*4*…*n</code>, respectively.
</p>
</dd>
<dt><code>cl_I binomial (uintL n, uintL k)</code></dt>
<dd><a name="index-binomial-_0028_0029"></a>
<p><code>n</code> and <code>k</code> must be small integers >= 0. This function returns the
binomial coefficient
for 0 <= k <= n, 0 else.
</p></dd>
</dl>
<hr>
<a name="Functions-on-floating_002dpoint-numbers"></a>
<div class="header">
<p>
Next: <a href="#Conversion-functions" accesskey="n" rel="next">Conversion functions</a>, Previous: <a href="#Functions-on-integers" accesskey="p" rel="prev">Functions on integers</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-on-floating_002dpoint-numbers-1"></a>
<h3 class="section">4.10 Functions on floating-point numbers</h3>
<p>Recall that a floating-point number consists of a sign <code>s</code>, an
exponent <code>e</code> and a mantissa <code>m</code>. The value of the number is
<code>(-1)^s * 2^e * m</code>.
</p>
<p>Each of the classes
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines the following operations.
</p>
<dl compact="compact">
<dt><code><var>type</var> scale_float (const <var>type</var>& x, sintC delta)</code></dt>
<dd><a name="index-scale_005ffloat-_0028_0029"></a>
</dd>
<dt><code><var>type</var> scale_float (const <var>type</var>& x, const cl_I& delta)</code></dt>
<dd><p>Returns <code>x*2^delta</code>. This is more efficient than an explicit multiplication
because it copies <code>x</code> and modifies the exponent.
</p></dd>
</dl>
<p>The following functions provide an abstract interface to the underlying
representation of floating-point numbers.
</p>
<dl compact="compact">
<dt><code>sintE float_exponent (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fexponent-_0028_0029"></a>
<p>Returns the exponent <code>e</code> of <code>x</code>.
For <code>x = 0.0</code>, this is 0. For <code>x</code> non-zero, this is the unique
integer with <code>2^(e-1) <= abs(x) < 2^e</code>.
</p>
</dd>
<dt><code>sintL float_radix (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fradix-_0028_0029"></a>
<p>Returns the base of the floating-point representation. This is always <code>2</code>.
</p>
</dd>
<dt><code><var>type</var> float_sign (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fsign-_0028_0029"></a>
<p>Returns the sign <code>s</code> of <code>x</code> as a float. The value is 1 for
<code>x</code> >= 0, -1 for <code>x</code> < 0.
</p>
</dd>
<dt><code>uintC float_digits (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fdigits-_0028_0029"></a>
<p>Returns the number of mantissa bits in the floating-point representation
of <code>x</code>, including the hidden bit. The value only depends on the type
of <code>x</code>, not on its value.
</p>
</dd>
<dt><code>uintC float_precision (const <var>type</var>& x)</code></dt>
<dd><a name="index-float_005fprecision-_0028_0029"></a>
<p>Returns the number of significant mantissa bits in the floating-point
representation of <code>x</code>. Since denormalized numbers are not supported,
this is the same as <code>float_digits(x)</code> if <code>x</code> is non-zero, and
0 if <code>x</code> = 0.
</p></dd>
</dl>
<p>The complete internal representation of a float is encoded in the type
<a name="index-decoded_005ffloat"></a>
<a name="index-decoded_005fsfloat"></a>
<a name="index-decoded_005fffloat"></a>
<a name="index-decoded_005fdfloat"></a>
<a name="index-decoded_005flfloat"></a>
<code>decoded_float</code> (or <code>decoded_sfloat</code>, <code>decoded_ffloat</code>,
<code>decoded_dfloat</code>, <code>decoded_lfloat</code>, respectively), defined by
</p><div class="example">
<pre class="example">struct decoded_<var>type</var>float {
<var>type</var> mantissa; cl_I exponent; <var>type</var> sign;
};
</pre></div>
<p>and returned by the function
</p>
<dl compact="compact">
<dt><code>decoded_<var>type</var>float decode_float (const <var>type</var>& x)</code></dt>
<dd><a name="index-decode_005ffloat-_0028_0029"></a>
<p>For <code>x</code> non-zero, this returns <code>(-1)^s</code>, <code>e</code>, <code>m</code> with
<code>x = (-1)^s * 2^e * m</code> and <code>0.5 <= m < 1.0</code>. For <code>x</code> = 0,
it returns <code>(-1)^s</code>=1, <code>e</code>=0, <code>m</code>=0.
<code>e</code> is the same as returned by the function <code>float_exponent</code>.
</p></dd>
</dl>
<p>A complete decoding in terms of integers is provided as type
<a name="index-cl_005fidecoded_005ffloat"></a>
</p><div class="example">
<pre class="example">struct cl_idecoded_float {
cl_I mantissa; cl_I exponent; cl_I sign;
};
</pre></div>
<p>by the following function:
</p>
<dl compact="compact">
<dt><code>cl_idecoded_float integer_decode_float (const <var>type</var>& x)</code></dt>
<dd><a name="index-integer_005fdecode_005ffloat-_0028_0029"></a>
<p>For <code>x</code> non-zero, this returns <code>(-1)^s</code>, <code>e</code>, <code>m</code> with
<code>x = (-1)^s * 2^e * m</code> and <code>m</code> an integer with <code>float_digits(x)</code>
bits. For <code>x</code> = 0, it returns <code>(-1)^s</code>=1, <code>e</code>=0, <code>m</code>=0.
WARNING: The exponent <code>e</code> is not the same as the one returned by
the functions <code>decode_float</code> and <code>float_exponent</code>.
</p></dd>
</dl>
<p>Some other function, implemented only for class <code>cl_F</code>:
</p>
<dl compact="compact">
<dt><code>cl_F float_sign (const cl_F& x, const cl_F& y)</code></dt>
<dd><a name="index-float_005fsign-_0028_0029-1"></a>
<p>This returns a floating point number whose precision and absolute value
is that of <code>y</code> and whose sign is that of <code>x</code>. If <code>x</code> is
zero, it is treated as positive. Same for <code>y</code>.
</p></dd>
</dl>
<hr>
<a name="Conversion-functions"></a>
<div class="header">
<p>
Next: <a href="#Random-number-generators" accesskey="n" rel="next">Random number generators</a>, Previous: <a href="#Functions-on-floating_002dpoint-numbers" accesskey="p" rel="prev">Functions on floating-point numbers</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Conversion-functions-1"></a>
<h3 class="section">4.11 Conversion functions</h3>
<a name="index-conversion-1"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Conversion-to-floating_002dpoint-numbers" accesskey="1">Conversion to floating-point numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Conversion-to-rational-numbers" accesskey="2">Conversion to rational numbers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Conversion-to-floating_002dpoint-numbers"></a>
<div class="header">
<p>
Next: <a href="#Conversion-to-rational-numbers" accesskey="n" rel="next">Conversion to rational numbers</a>, Up: <a href="#Conversion-functions" accesskey="u" rel="up">Conversion functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Conversion-to-floating_002dpoint-numbers-1"></a>
<h4 class="subsection">4.11.1 Conversion to floating-point numbers</h4>
<p>The type <code>float_format_t</code> describes a floating-point format.
<a name="index-float_005fformat_005ft"></a>
</p>
<dl compact="compact">
<dt><code>float_format_t float_format (uintE n)</code></dt>
<dd><a name="index-float_005fformat-_0028_0029"></a>
<p>Returns the smallest float format which guarantees at least <code>n</code>
decimal digits in the mantissa (after the decimal point).
</p>
</dd>
<dt><code>float_format_t float_format (const cl_F& x)</code></dt>
<dd><p>Returns the floating point format of <code>x</code>.
</p>
</dd>
<dt><code>float_format_t default_float_format</code></dt>
<dd><a name="index-default_005ffloat_005fformat"></a>
<p>Global variable: the default float format used when converting rational numbers
to floats.
</p></dd>
</dl>
<p>To convert a real number to a float, each of the types
<code>cl_R</code>, <code>cl_F</code>, <code>cl_I</code>, <code>cl_RA</code>,
<code>int</code>, <code>unsigned int</code>, <code>float</code>, <code>double</code>
defines the following operations:
</p>
<dl compact="compact">
<dt><code>cl_F cl_float (const <var>type</var>&x, float_format_t f)</code></dt>
<dd><a name="index-cl_005ffloat-_0028_0029"></a>
<p>Returns <code>x</code> as a float of format <code>f</code>.
</p></dd>
<dt><code>cl_F cl_float (const <var>type</var>&x, const cl_F& y)</code></dt>
<dd><p>Returns <code>x</code> in the float format of <code>y</code>.
</p></dd>
<dt><code>cl_F cl_float (const <var>type</var>&x)</code></dt>
<dd><p>Returns <code>x</code> as a float of format <code>default_float_format</code> if
it is an exact number, or <code>x</code> itself if it is already a float.
</p></dd>
</dl>
<p>Of course, converting a number to a float can lose precision.
</p>
<p>Every floating-point format has some characteristic numbers:
</p>
<dl compact="compact">
<dt><code>cl_F most_positive_float (float_format_t f)</code></dt>
<dd><a name="index-most_005fpositive_005ffloat-_0028_0029"></a>
<p>Returns the largest (most positive) floating point number in float format <code>f</code>.
</p>
</dd>
<dt><code>cl_F most_negative_float (float_format_t f)</code></dt>
<dd><a name="index-most_005fnegative_005ffloat-_0028_0029"></a>
<p>Returns the smallest (most negative) floating point number in float format <code>f</code>.
</p>
</dd>
<dt><code>cl_F least_positive_float (float_format_t f)</code></dt>
<dd><a name="index-least_005fpositive_005ffloat-_0028_0029"></a>
<p>Returns the least positive floating point number (i.e. > 0 but closest to 0)
in float format <code>f</code>.
</p>
</dd>
<dt><code>cl_F least_negative_float (float_format_t f)</code></dt>
<dd><a name="index-least_005fnegative_005ffloat-_0028_0029"></a>
<p>Returns the least negative floating point number (i.e. < 0 but closest to 0)
in float format <code>f</code>.
</p>
</dd>
<dt><code>cl_F float_epsilon (float_format_t f)</code></dt>
<dd><a name="index-float_005fepsilon-_0028_0029"></a>
<p>Returns the smallest floating point number e > 0 such that <code>1+e != 1</code>.
</p>
</dd>
<dt><code>cl_F float_negative_epsilon (float_format_t f)</code></dt>
<dd><a name="index-float_005fnegative_005fepsilon-_0028_0029"></a>
<p>Returns the smallest floating point number e > 0 such that <code>1-e != 1</code>.
</p></dd>
</dl>
<hr>
<a name="Conversion-to-rational-numbers"></a>
<div class="header">
<p>
Previous: <a href="#Conversion-to-floating_002dpoint-numbers" accesskey="p" rel="prev">Conversion to floating-point numbers</a>, Up: <a href="#Conversion-functions" accesskey="u" rel="up">Conversion functions</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Conversion-to-rational-numbers-1"></a>
<h4 class="subsection">4.11.2 Conversion to rational numbers</h4>
<p>Each of the classes <code>cl_R</code>, <code>cl_RA</code>, <code>cl_F</code>
defines the following operation:
</p>
<dl compact="compact">
<dt><code>cl_RA rational (const <var>type</var>& x)</code></dt>
<dd><a name="index-rational-_0028_0029"></a>
<p>Returns the value of <code>x</code> as an exact number. If <code>x</code> is already
an exact number, this is <code>x</code>. If <code>x</code> is a floating-point number,
the value is a rational number whose denominator is a power of 2.
</p></dd>
</dl>
<p>In order to convert back, say, <code>(cl_F)(cl_R)"1/3"</code> to <code>1/3</code>, there is
the function
</p>
<dl compact="compact">
<dt><code>cl_RA rationalize (const cl_R& x)</code></dt>
<dd><a name="index-rationalize-_0028_0029"></a>
<p>If <code>x</code> is a floating-point number, it actually represents an interval
of real numbers, and this function returns the rational number with
smallest denominator (and smallest numerator, in magnitude)
which lies in this interval.
If <code>x</code> is already an exact number, this function returns <code>x</code>.
</p></dd>
</dl>
<p>If <code>x</code> is any float, one has
</p>
<ul class="no-bullet">
<li><!-- /@w --> <code>cl_float(rational(x),x) = x</code>
</li><li><!-- /@w --> <code>cl_float(rationalize(x),x) = x</code>
</li></ul>
<hr>
<a name="Random-number-generators"></a>
<div class="header">
<p>
Next: <a href="#Modifying-operators" accesskey="n" rel="next">Modifying operators</a>, Previous: <a href="#Conversion-functions" accesskey="p" rel="prev">Conversion functions</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Random-number-generators-1"></a>
<h3 class="section">4.12 Random number generators</h3>
<p>A random generator is a machine which produces (pseudo-)random numbers.
The include file <code><cln/random.h></code> defines a class <code>random_state</code>
which contains the state of a random generator. If you make a copy
of the random number generator, the original one and the copy will produce
the same sequence of random numbers.
</p>
<p>The following functions return (pseudo-)random numbers in different formats.
Calling one of these modifies the state of the random number generator in
a complicated but deterministic way.
</p>
<p>The global variable
<a name="index-random_005fstate"></a>
<a name="index-default_005frandom_005fstate"></a>
</p><div class="example">
<pre class="example">random_state default_random_state
</pre></div>
<p>contains a default random number generator. It is used when the functions
below are called without <code>random_state</code> argument.
</p>
<dl compact="compact">
<dt><code>uint32 random32 (random_state& randomstate)</code></dt>
<dt><code>uint32 random32 ()</code></dt>
<dd><a name="index-random32-_0028_0029"></a>
<p>Returns a random unsigned 32-bit number. All bits are equally random.
</p>
</dd>
<dt><code>cl_I random_I (random_state& randomstate, const cl_I& n)</code></dt>
<dt><code>cl_I random_I (const cl_I& n)</code></dt>
<dd><a name="index-random_005fI-_0028_0029"></a>
<p><code>n</code> must be an integer > 0. This function returns a random integer <code>x</code>
in the range <code>0 <= x < n</code>.
</p>
</dd>
<dt><code>cl_F random_F (random_state& randomstate, const cl_F& n)</code></dt>
<dt><code>cl_F random_F (const cl_F& n)</code></dt>
<dd><a name="index-random_005fF-_0028_0029"></a>
<p><code>n</code> must be a float > 0. This function returns a random floating-point
number of the same format as <code>n</code> in the range <code>0 <= x < n</code>.
</p>
</dd>
<dt><code>cl_R random_R (random_state& randomstate, const cl_R& n)</code></dt>
<dt><code>cl_R random_R (const cl_R& n)</code></dt>
<dd><a name="index-random_005fR-_0028_0029"></a>
<p>Behaves like <code>random_I</code> if <code>n</code> is an integer and like <code>random_F</code>
if <code>n</code> is a float.
</p></dd>
</dl>
<hr>
<a name="Modifying-operators"></a>
<div class="header">
<p>
Previous: <a href="#Random-number-generators" accesskey="p" rel="prev">Random number generators</a>, Up: <a href="#Functions-on-numbers" accesskey="u" rel="up">Functions on numbers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Modifying-operators-1"></a>
<h3 class="section">4.13 Modifying operators</h3>
<a name="index-modifying-operators"></a>
<p>The modifying C/C++ operators <code>+=</code>, <code>-=</code>, <code>*=</code>, <code>/=</code>,
<code>&=</code>, <code>|=</code>, <code>^=</code>, <code><<=</code>, <code>>>=</code>
are all available.
</p>
<p>For the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>:
</p>
<dl compact="compact">
<dt><code><var>type</var>& operator += (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002b_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator -= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002d_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator *= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002a_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator /= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_002f_003d-_0028_0029"></a>
</dd>
</dl>
<p>For the class <code>cl_I</code>:
</p>
<dl compact="compact">
<dt><code><var>type</var>& operator += (<var>type</var>&, const <var>type</var>&)</code></dt>
<dt><code><var>type</var>& operator -= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dt><code><var>type</var>& operator *= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dt><code><var>type</var>& operator &= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_0026_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator |= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_007c_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator ^= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_005e_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator <<= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003c_003c_003d-_0028_0029"></a>
</dd>
<dt><code><var>type</var>& operator >>= (<var>type</var>&, const <var>type</var>&)</code></dt>
<dd><a name="index-operator-_003e_003e_003d-_0028_0029"></a>
</dd>
</dl>
<p>For the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>:
</p>
<dl compact="compact">
<dt><code><var>type</var>& operator ++ (<var>type</var>& x)</code></dt>
<dd><a name="index-operator-_002b_002b-_0028_0029"></a>
<p>The prefix operator <code>++x</code>.
</p>
</dd>
<dt><code>void operator ++ (<var>type</var>& x, int)</code></dt>
<dd><p>The postfix operator <code>x++</code>.
</p>
</dd>
<dt><code><var>type</var>& operator -- (<var>type</var>& x)</code></dt>
<dd><a name="index-operator-_002d_002d-_0028_0029"></a>
<p>The prefix operator <code>--x</code>.
</p>
</dd>
<dt><code>void operator -- (<var>type</var>& x, int)</code></dt>
<dd><p>The postfix operator <code>x--</code>.
</p></dd>
</dl>
<p>Note that by using these modifying operators, you don’t gain efficiency:
In CLN ‘<samp>x += y;</samp>’ is exactly the same as ‘<samp>x = x+y;</samp>’, not more
efficient.
</p>
<hr>
<a name="Input_002fOutput"></a>
<div class="header">
<p>
Next: <a href="#Rings" accesskey="n" rel="next">Rings</a>, Previous: <a href="#Functions-on-numbers" accesskey="p" rel="prev">Functions on numbers</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Input_002fOutput-1"></a>
<h2 class="chapter">5 Input/Output</h2>
<a name="index-Input_002fOutput"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Internal-and-printed-representation" accesskey="1">Internal and printed representation</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Input-functions" accesskey="2">Input functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Output-functions" accesskey="3">Output functions</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Internal-and-printed-representation"></a>
<div class="header">
<p>
Next: <a href="#Input-functions" accesskey="n" rel="next">Input functions</a>, Up: <a href="#Input_002fOutput" accesskey="u" rel="up">Input/Output</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internal-and-printed-representation-1"></a>
<h3 class="section">5.1 Internal and printed representation</h3>
<a name="index-representation"></a>
<p>All computations deal with the internal representations of the numbers.
</p>
<p>Every number has an external representation as a sequence of ASCII characters.
Several external representations may denote the same number, for example,
"20.0" and "20.000".
</p>
<p>Converting an internal to an external representation is called “printing”,
<a name="index-printing"></a>
converting an external to an internal representation is called “reading”.
<a name="index-reading"></a>
In CLN, it is always true that conversion of an internal to an external
representation and then back to an internal representation will yield the
same internal representation. Symbolically: <code>read(print(x)) == x</code>.
This is called “print-read consistency”.
</p>
<p>Different types of numbers have different external representations (case
is insignificant):
</p>
<dl compact="compact">
<dt>Integers</dt>
<dd><p>External representation: <var>sign</var>{<var>digit</var>}+. The reader also accepts the
Common Lisp syntaxes <var>sign</var>{<var>digit</var>}+<code>.</code> with a trailing dot
for decimal integers
and the <code>#<var>n</var>R</code>, <code>#b</code>, <code>#o</code>, <code>#x</code> prefixes.
</p>
</dd>
<dt>Rational numbers</dt>
<dd><p>External representation: <var>sign</var>{<var>digit</var>}+<code>/</code>{<var>digit</var>}+.
The <code>#<var>n</var>R</code>, <code>#b</code>, <code>#o</code>, <code>#x</code> prefixes are allowed
here as well.
</p>
</dd>
<dt>Floating-point numbers</dt>
<dd><p>External representation: <var>sign</var>{<var>digit</var>}*<var>exponent</var> or
<var>sign</var>{<var>digit</var>}*<code>.</code>{<var>digit</var>}*<var>exponent</var> or
<var>sign</var>{<var>digit</var>}*<code>.</code>{<var>digit</var>}+. A precision specifier
of the form _<var>prec</var> may be appended. There must be at least
one digit in the non-exponent part. The exponent has the syntax
<var>expmarker</var> <var>expsign</var> {<var>digit</var>}+.
The exponent marker is
</p>
<ul class="no-bullet">
<li><!-- /@w --> ‘<samp>s</samp>’ for short-floats,
</li><li><!-- /@w --> ‘<samp>f</samp>’ for single-floats,
</li><li><!-- /@w --> ‘<samp>d</samp>’ for double-floats,
</li><li><!-- /@w --> ‘<samp>L</samp>’ for long-floats,
</li></ul>
<p>or ‘<samp>e</samp>’, which denotes a default float format. The precision specifying
suffix has the syntax _<var>prec</var> where <var>prec</var> denotes the number of
valid mantissa digits (in decimal, excluding leading zeroes), cf. also
function ‘<samp>float_format</samp>’.
</p>
</dd>
<dt>Complex numbers</dt>
<dd><p>External representation:
</p><ul class="no-bullet">
<li><!-- /@w --> In algebraic notation: <code><var>realpart</var>+<var>imagpart</var>i</code>. Of course,
if <var>imagpart</var> is negative, its printed representation begins with
a ‘<samp>-</samp>’, and the ‘<samp>+</samp>’ between <var>realpart</var> and <var>imagpart</var>
may be omitted. Note that this notation cannot be used when the <var>imagpart</var>
is rational and the rational number’s base is >18, because the ‘<samp>i</samp>’
is then read as a digit.
</li><li><!-- /@w --> In Common Lisp notation: <code>#C(<var>realpart</var> <var>imagpart</var>)</code>.
</li></ul>
</dd>
</dl>
<hr>
<a name="Input-functions"></a>
<div class="header">
<p>
Next: <a href="#Output-functions" accesskey="n" rel="next">Output functions</a>, Previous: <a href="#Internal-and-printed-representation" accesskey="p" rel="prev">Internal and printed representation</a>, Up: <a href="#Input_002fOutput" accesskey="u" rel="up">Input/Output</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Input-functions-1"></a>
<h3 class="section">5.2 Input functions</h3>
<p>Including <code><cln/io.h></code> defines flexible input functions:
</p>
<dl compact="compact">
<dt><code>cl_N read_complex (std::istream& stream, const cl_read_flags& flags)</code></dt>
<dt><code>cl_R read_real (std::istream& stream, const cl_read_flags& flags)</code></dt>
<dt><code>cl_F read_float (std::istream& stream, const cl_read_flags& flags)</code></dt>
<dt><code>cl_RA read_rational (std::istream& stream, const cl_read_flags& flags)</code></dt>
<dt><code>cl_I read_integer (std::istream& stream, const cl_read_flags& flags)</code></dt>
<dd><p>Reads a number from <code>stream</code>. The <code>flags</code> are parameters which
affect the input syntax. Whitespace before the number is silently skipped.
</p>
</dd>
<dt><code>cl_N read_complex (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)</code></dt>
<dt><code>cl_R read_real (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)</code></dt>
<dt><code>cl_F read_float (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)</code></dt>
<dt><code>cl_RA read_rational (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)</code></dt>
<dt><code>cl_I read_integer (const cl_read_flags& flags, const char * string, const char * string_limit, const char * * end_of_parse)</code></dt>
<dd><p>Reads a number from a string in memory. The <code>flags</code> are parameters which
affect the input syntax. The string starts at <code>string</code> and ends at
<code>string_limit</code> (exclusive limit). <code>string_limit</code> may also be
<code>NULL</code>, denoting the entire string, i.e. equivalent to
<code>string_limit = string + strlen(string)</code>. If <code>end_of_parse</code> is
<code>NULL</code>, the string in memory must contain exactly one number and nothing
more, else an exception will be thrown. If <code>end_of_parse</code>
is not <code>NULL</code>, <code>*end_of_parse</code> will be assigned a pointer past
the last parsed character (i.e. <code>string_limit</code> if nothing came after
the number). Whitespace is not allowed.
</p></dd>
</dl>
<p>The structure <code>cl_read_flags</code> contains the following fields:
</p>
<dl compact="compact">
<dt><code>cl_read_syntax_t syntax</code></dt>
<dd><p>The possible results of the read operation. Possible values are
<code>syntax_number</code>, <code>syntax_real</code>, <code>syntax_rational</code>,
<code>syntax_integer</code>, <code>syntax_float</code>, <code>syntax_sfloat</code>,
<code>syntax_ffloat</code>, <code>syntax_dfloat</code>, <code>syntax_lfloat</code>.
</p>
</dd>
<dt><code>cl_read_lsyntax_t lsyntax</code></dt>
<dd><p>Specifies the language-dependent syntax variant for the read operation.
Possible values are
</p>
<dl compact="compact">
<dt><code>lsyntax_standard</code></dt>
<dd><p>accept standard algebraic notation only, no complex numbers,
</p></dd>
<dt><code>lsyntax_algebraic</code></dt>
<dd><p>accept the algebraic notation <code><var>x</var>+<var>y</var>i</code> for complex numbers,
</p></dd>
<dt><code>lsyntax_commonlisp</code></dt>
<dd><p>accept the <code>#b</code>, <code>#o</code>, <code>#x</code> syntaxes for binary, octal,
hexadecimal numbers,
<code>#<var>base</var>R</code> for rational numbers in a given base,
<code>#c(<var>realpart</var> <var>imagpart</var>)</code> for complex numbers,
</p></dd>
<dt><code>lsyntax_all</code></dt>
<dd><p>accept all of these extensions.
</p></dd>
</dl>
</dd>
<dt><code>unsigned int rational_base</code></dt>
<dd><p>The base in which rational numbers are read.
</p>
</dd>
<dt><code>float_format_t float_flags.default_float_format</code></dt>
<dd><p>The float format used when reading floats with exponent marker ‘<samp>e</samp>’.
</p>
</dd>
<dt><code>float_format_t float_flags.default_lfloat_format</code></dt>
<dd><p>The float format used when reading floats with exponent marker ‘<samp>l</samp>’.
</p>
</dd>
<dt><code>bool float_flags.mantissa_dependent_float_format</code></dt>
<dd><p>When this flag is true, floats specified with more digits than corresponding
to the exponent marker they contain, but without <var>_nnn</var> suffix, will get a
precision corresponding to their number of significant digits.
</p></dd>
</dl>
<hr>
<a name="Output-functions"></a>
<div class="header">
<p>
Previous: <a href="#Input-functions" accesskey="p" rel="prev">Input functions</a>, Up: <a href="#Input_002fOutput" accesskey="u" rel="up">Input/Output</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Output-functions-1"></a>
<h3 class="section">5.3 Output functions</h3>
<p>Including <code><cln/io.h></code> defines a number of simple output functions
that write to <code>std::ostream&</code>:
</p>
<dl compact="compact">
<dt><code>void fprintchar (std::ostream& stream, char c)</code></dt>
<dd><p>Prints the character <code>x</code> literally on the <code>stream</code>.
</p>
</dd>
<dt><code>void fprint (std::ostream& stream, const char * string)</code></dt>
<dd><p>Prints the <code>string</code> literally on the <code>stream</code>.
</p>
</dd>
<dt><code>void fprintdecimal (std::ostream& stream, int x)</code></dt>
<dt><code>void fprintdecimal (std::ostream& stream, const cl_I& x)</code></dt>
<dd><p>Prints the integer <code>x</code> in decimal on the <code>stream</code>.
</p>
</dd>
<dt><code>void fprintbinary (std::ostream& stream, const cl_I& x)</code></dt>
<dd><p>Prints the integer <code>x</code> in binary (base 2, without prefix)
on the <code>stream</code>.
</p>
</dd>
<dt><code>void fprintoctal (std::ostream& stream, const cl_I& x)</code></dt>
<dd><p>Prints the integer <code>x</code> in octal (base 8, without prefix)
on the <code>stream</code>.
</p>
</dd>
<dt><code>void fprinthexadecimal (std::ostream& stream, const cl_I& x)</code></dt>
<dd><p>Prints the integer <code>x</code> in hexadecimal (base 16, without prefix)
on the <code>stream</code>.
</p></dd>
</dl>
<p>Each of the classes <code>cl_N</code>, <code>cl_R</code>, <code>cl_RA</code>, <code>cl_I</code>,
<code>cl_F</code>, <code>cl_SF</code>, <code>cl_FF</code>, <code>cl_DF</code>, <code>cl_LF</code>
defines, in <code><cln/<var>type</var>_io.h></code>, the following output functions:
</p>
<dl compact="compact">
<dt><code>void fprint (std::ostream& stream, const <var>type</var>& x)</code></dt>
<dt><code>std::ostream& operator<< (std::ostream& stream, const <var>type</var>& x)</code></dt>
<dd><p>Prints the number <code>x</code> on the <code>stream</code>. The output may depend
on the global printer settings in the variable <code>default_print_flags</code>.
The <code>ostream</code> flags and settings (flags, width and locale) are
ignored.
</p></dd>
</dl>
<p>The most flexible output function, defined in <code><cln/<var>type</var>_io.h></code>,
are the following:
</p><div class="example">
<pre class="example">void print_complex (std::ostream& stream, const cl_print_flags& flags,
const cl_N& z);
void print_real (std::ostream& stream, const cl_print_flags& flags,
const cl_R& z);
void print_float (std::ostream& stream, const cl_print_flags& flags,
const cl_F& z);
void print_rational (std::ostream& stream, const cl_print_flags& flags,
const cl_RA& z);
void print_integer (std::ostream& stream, const cl_print_flags& flags,
const cl_I& z);
</pre></div>
<p>Prints the number <code>x</code> on the <code>stream</code>. The <code>flags</code> are
parameters which affect the output.
</p>
<p>The structure type <code>cl_print_flags</code> contains the following fields:
</p>
<dl compact="compact">
<dt><code>unsigned int rational_base</code></dt>
<dd><p>The base in which rational numbers are printed. Default is <code>10</code>.
</p>
</dd>
<dt><code>bool rational_readably</code></dt>
<dd><p>If this flag is true, rational numbers are printed with radix specifiers in
Common Lisp syntax (<code>#<var>n</var>R</code> or <code>#b</code> or <code>#o</code> or <code>#x</code>
prefixes, trailing dot). Default is false.
</p>
</dd>
<dt><code>bool float_readably</code></dt>
<dd><p>If this flag is true, type specific exponent markers have precedence over ’E’.
Default is false.
</p>
</dd>
<dt><code>float_format_t default_float_format</code></dt>
<dd><p>Floating point numbers of this format will be printed using the ’E’ exponent
marker. Default is <code>float_format_ffloat</code>.
</p>
</dd>
<dt><code>bool complex_readably</code></dt>
<dd><p>If this flag is true, complex numbers will be printed using the Common Lisp
syntax <code>#C(<var>realpart</var> <var>imagpart</var>)</code>. Default is false.
</p>
</dd>
<dt><code>cl_string univpoly_varname</code></dt>
<dd><p>Univariate polynomials with no explicit indeterminate name will be printed
using this variable name. Default is <code>"x"</code>.
</p></dd>
</dl>
<p>The global variable <code>default_print_flags</code> contains the default values,
used by the function <code>fprint</code>.
</p>
<hr>
<a name="Rings"></a>
<div class="header">
<p>
Next: <a href="#Modular-integers" accesskey="n" rel="next">Modular integers</a>, Previous: <a href="#Input_002fOutput" accesskey="p" rel="prev">Input/Output</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Rings-1"></a>
<h2 class="chapter">6 Rings</h2>
<p>CLN has a class of abstract rings.
</p>
<div class="example">
<pre class="example"> Ring
cl_ring
<cln/ring.h>
</pre></div>
<p>Rings can be compared for equality:
</p>
<dl compact="compact">
<dt><code>bool operator== (const cl_ring&, const cl_ring&)</code></dt>
<dt><code>bool operator!= (const cl_ring&, const cl_ring&)</code></dt>
<dd><p>These compare two rings for equality.
</p></dd>
</dl>
<p>Given a ring <code>R</code>, the following members can be used.
</p>
<dl compact="compact">
<dt><code>void R->fprint (std::ostream& stream, const cl_ring_element& x)</code></dt>
<dd><a name="index-fprint-_0028_0029"></a>
</dd>
<dt><code>bool R->equal (const cl_ring_element& x, const cl_ring_element& y)</code></dt>
<dd><a name="index-equal-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->zero ()</code></dt>
<dd><a name="index-zero-_0028_0029"></a>
</dd>
<dt><code>bool R->zerop (const cl_ring_element& x)</code></dt>
<dd><a name="index-zerop-_0028_0029-1"></a>
</dd>
<dt><code>cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y)</code></dt>
<dd><a name="index-plus-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y)</code></dt>
<dd><a name="index-minus-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->uminus (const cl_ring_element& x)</code></dt>
<dd><a name="index-uminus-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->one ()</code></dt>
<dd><a name="index-one-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->canonhom (const cl_I& x)</code></dt>
<dd><a name="index-canonhom-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y)</code></dt>
<dd><a name="index-mul-_0028_0029"></a>
</dd>
<dt><code>cl_ring_element R->square (const cl_ring_element& x)</code></dt>
<dd><a name="index-square-_0028_0029-1"></a>
</dd>
<dt><code>cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y)</code></dt>
<dd><a name="index-expt_005fpos-_0028_0029-1"></a>
</dd>
</dl>
<p>The following rings are built-in.
</p>
<dl compact="compact">
<dt><code>cl_null_ring cl_0_ring</code></dt>
<dd><p>The null ring, containing only zero.
</p>
</dd>
<dt><code>cl_complex_ring cl_C_ring</code></dt>
<dd><p>The ring of complex numbers. This corresponds to the type <code>cl_N</code>.
</p>
</dd>
<dt><code>cl_real_ring cl_R_ring</code></dt>
<dd><p>The ring of real numbers. This corresponds to the type <code>cl_R</code>.
</p>
</dd>
<dt><code>cl_rational_ring cl_RA_ring</code></dt>
<dd><p>The ring of rational numbers. This corresponds to the type <code>cl_RA</code>.
</p>
</dd>
<dt><code>cl_integer_ring cl_I_ring</code></dt>
<dd><p>The ring of integers. This corresponds to the type <code>cl_I</code>.
</p></dd>
</dl>
<p>Type tests can be performed for any of <code>cl_C_ring</code>, <code>cl_R_ring</code>,
<code>cl_RA_ring</code>, <code>cl_I_ring</code>:
</p>
<dl compact="compact">
<dt><code>bool instanceof (const cl_number& x, const cl_number_ring& R)</code></dt>
<dd><a name="index-instanceof-_0028_0029"></a>
<p>Tests whether the given number is an element of the number ring R.
</p></dd>
</dl>
<hr>
<a name="Modular-integers"></a>
<div class="header">
<p>
Next: <a href="#Symbolic-data-types" accesskey="n" rel="next">Symbolic data types</a>, Previous: <a href="#Rings" accesskey="p" rel="prev">Rings</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Modular-integers-1"></a>
<h2 class="chapter">7 Modular integers</h2>
<a name="index-modular-integer"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Modular-integer-rings" accesskey="1">Modular integer rings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-modular-integers" accesskey="2">Functions on modular integers</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Modular-integer-rings"></a>
<div class="header">
<p>
Next: <a href="#Functions-on-modular-integers" accesskey="n" rel="next">Functions on modular integers</a>, Up: <a href="#Modular-integers" accesskey="u" rel="up">Modular integers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Modular-integer-rings-1"></a>
<h3 class="section">7.1 Modular integer rings</h3>
<a name="index-ring"></a>
<p>CLN implements modular integers, i.e. integers modulo a fixed integer N.
The modulus is explicitly part of every modular integer. CLN doesn’t
allow you to (accidentally) mix elements of different modular rings,
e.g. <code>(3 mod 4) + (2 mod 5)</code> will result in a runtime error.
(Ideally one would imagine a generic data type <code>cl_MI(N)</code>, but C++
doesn’t have generic types. So one has to live with runtime checks.)
</p>
<p>The class of modular integer rings is
</p>
<div class="example">
<pre class="example"> Ring
cl_ring
<cln/ring.h>
|
|
Modular integer ring
cl_modint_ring
<cln/modinteger.h>
</pre></div>
<a name="index-cl_005fmodint_005fring"></a>
<p>and the class of all modular integers (elements of modular integer rings) is
</p>
<div class="example">
<pre class="example"> Modular integer
cl_MI
<cln/modinteger.h>
</pre></div>
<p>Modular integer rings are constructed using the function
</p>
<dl compact="compact">
<dt><code>cl_modint_ring find_modint_ring (const cl_I& N)</code></dt>
<dd><a name="index-find_005fmodint_005fring-_0028_0029"></a>
<p>This function returns the modular ring ‘<samp>Z/NZ</samp>’. It takes care
of finding out about special cases of <code>N</code>, like powers of two
and odd numbers for which Montgomery multiplication will be a win,
<a name="index-Montgomery-multiplication"></a>
and precomputes any necessary auxiliary data for computing modulo <code>N</code>.
There is a cache table of rings, indexed by <code>N</code> (or, more precisely,
by <code>abs(N)</code>). This ensures that the precomputation costs are reduced
to a minimum.
</p></dd>
</dl>
<p>Modular integer rings can be compared for equality:
</p>
<dl compact="compact">
<dt><code>bool operator== (const cl_modint_ring&, const cl_modint_ring&)</code></dt>
<dd><a name="index-operator-_003d_003d-_0028_0029-1"></a>
</dd>
<dt><code>bool operator!= (const cl_modint_ring&, const cl_modint_ring&)</code></dt>
<dd><a name="index-operator-_0021_003d-_0028_0029-1"></a>
<p>These compare two modular integer rings for equality. Two different calls
to <code>find_modint_ring</code> with the same argument necessarily return the
same ring because it is memoized in the cache table.
</p></dd>
</dl>
<hr>
<a name="Functions-on-modular-integers"></a>
<div class="header">
<p>
Previous: <a href="#Modular-integer-rings" accesskey="p" rel="prev">Modular integer rings</a>, Up: <a href="#Modular-integers" accesskey="u" rel="up">Modular integers</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-on-modular-integers-1"></a>
<h3 class="section">7.2 Functions on modular integers</h3>
<p>Given a modular integer ring <code>R</code>, the following members can be used.
</p>
<dl compact="compact">
<dt><code>cl_I R->modulus</code></dt>
<dd><a name="index-modulus"></a>
<p>This is the ring’s modulus, normalized to be nonnegative: <code>abs(N)</code>.
</p>
</dd>
<dt><code>cl_MI R->zero()</code></dt>
<dd><a name="index-zero-_0028_0029-1"></a>
<p>This returns <code>0 mod N</code>.
</p>
</dd>
<dt><code>cl_MI R->one()</code></dt>
<dd><a name="index-one-_0028_0029-1"></a>
<p>This returns <code>1 mod N</code>.
</p>
</dd>
<dt><code>cl_MI R->canonhom (const cl_I& x)</code></dt>
<dd><a name="index-canonhom-_0028_0029-1"></a>
<p>This returns <code>x mod N</code>.
</p>
</dd>
<dt><code>cl_I R->retract (const cl_MI& x)</code></dt>
<dd><a name="index-retract-_0028_0029"></a>
<p>This is a partial inverse function to <code>R->canonhom</code>. It returns the
standard representative (<code>>=0</code>, <code><N</code>) of <code>x</code>.
</p>
</dd>
<dt><code>cl_MI R->random(random_state& randomstate)</code></dt>
<dt><code>cl_MI R->random()</code></dt>
<dd><a name="index-random-_0028_0029"></a>
<p>This returns a random integer modulo <code>N</code>.
</p></dd>
</dl>
<p>The following operations are defined on modular integers.
</p>
<dl compact="compact">
<dt><code>cl_modint_ring x.ring ()</code></dt>
<dd><a name="index-ring-_0028_0029"></a>
<p>Returns the ring to which the modular integer <code>x</code> belongs.
</p>
</dd>
<dt><code>cl_MI operator+ (const cl_MI&, const cl_MI&)</code></dt>
<dd><a name="index-operator-_002b-_0028_0029-1"></a>
<p>Returns the sum of two modular integers. One of the arguments may also
be a plain integer.
</p>
</dd>
<dt><code>cl_MI operator- (const cl_MI&, const cl_MI&)</code></dt>
<dd><a name="index-operator-_002d-_0028_0029-1"></a>
<p>Returns the difference of two modular integers. One of the arguments may also
be a plain integer.
</p>
</dd>
<dt><code>cl_MI operator- (const cl_MI&)</code></dt>
<dd><p>Returns the negative of a modular integer.
</p>
</dd>
<dt><code>cl_MI operator* (const cl_MI&, const cl_MI&)</code></dt>
<dd><a name="index-operator-_002a-_0028_0029-1"></a>
<p>Returns the product of two modular integers. One of the arguments may also
be a plain integer.
</p>
</dd>
<dt><code>cl_MI square (const cl_MI&)</code></dt>
<dd><a name="index-square-_0028_0029-2"></a>
<p>Returns the square of a modular integer.
</p>
</dd>
<dt><code>cl_MI recip (const cl_MI& x)</code></dt>
<dd><a name="index-recip-_0028_0029-1"></a>
<p>Returns the reciprocal <code>x^-1</code> of a modular integer <code>x</code>. <code>x</code>
must be coprime to the modulus, otherwise an error message is issued.
</p>
</dd>
<dt><code>cl_MI div (const cl_MI& x, const cl_MI& y)</code></dt>
<dd><a name="index-div-_0028_0029"></a>
<p>Returns the quotient <code>x*y^-1</code> of two modular integers <code>x</code>, <code>y</code>.
<code>y</code> must be coprime to the modulus, otherwise an error message is issued.
</p>
</dd>
<dt><code>cl_MI expt_pos (const cl_MI& x, const cl_I& y)</code></dt>
<dd><a name="index-expt_005fpos-_0028_0029-2"></a>
<p><code>y</code> must be > 0. Returns <code>x^y</code>.
</p>
</dd>
<dt><code>cl_MI expt (const cl_MI& x, const cl_I& y)</code></dt>
<dd><a name="index-expt-_0028_0029-2"></a>
<p>Returns <code>x^y</code>. If <code>y</code> is negative, <code>x</code> must be coprime to the
modulus, else an error message is issued.
</p>
</dd>
<dt><code>cl_MI operator<< (const cl_MI& x, const cl_I& y)</code></dt>
<dd><a name="index-operator-_003c_003c-_0028_0029-1"></a>
<p>Returns <code>x*2^y</code>.
</p>
</dd>
<dt><code>cl_MI operator>> (const cl_MI& x, const cl_I& y)</code></dt>
<dd><a name="index-operator-_003e_003e-_0028_0029-1"></a>
<p>Returns <code>x*2^-y</code>. When <code>y</code> is positive, the modulus must be odd,
or an error message is issued.
</p>
</dd>
<dt><code>bool operator== (const cl_MI&, const cl_MI&)</code></dt>
<dd><a name="index-operator-_003d_003d-_0028_0029-2"></a>
</dd>
<dt><code>bool operator!= (const cl_MI&, const cl_MI&)</code></dt>
<dd><a name="index-operator-_0021_003d-_0028_0029-2"></a>
<p>Compares two modular integers, belonging to the same modular integer ring,
for equality.
</p>
</dd>
<dt><code>bool zerop (const cl_MI& x)</code></dt>
<dd><a name="index-zerop-_0028_0029-2"></a>
<p>Returns true if <code>x</code> is <code>0 mod N</code>.
</p></dd>
</dl>
<p>The following output functions are defined (see also the chapter on
input/output).
</p>
<dl compact="compact">
<dt><code>void fprint (std::ostream& stream, const cl_MI& x)</code></dt>
<dd><a name="index-fprint-_0028_0029-1"></a>
</dd>
<dt><code>std::ostream& operator<< (std::ostream& stream, const cl_MI& x)</code></dt>
<dd><a name="index-operator-_003c_003c-_0028_0029-2"></a>
<p>Prints the modular integer <code>x</code> on the <code>stream</code>. The output may depend
on the global printer settings in the variable <code>default_print_flags</code>.
</p></dd>
</dl>
<hr>
<a name="Symbolic-data-types"></a>
<div class="header">
<p>
Next: <a href="#Univariate-polynomials" accesskey="n" rel="next">Univariate polynomials</a>, Previous: <a href="#Modular-integers" accesskey="p" rel="prev">Modular integers</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Symbolic-data-types-1"></a>
<h2 class="chapter">8 Symbolic data types</h2>
<a name="index-symbolic-type"></a>
<p>CLN implements two symbolic (non-numeric) data types: strings and symbols.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Strings" accesskey="1">Strings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Symbols" accesskey="2">Symbols</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Strings"></a>
<div class="header">
<p>
Next: <a href="#Symbols" accesskey="n" rel="next">Symbols</a>, Up: <a href="#Symbolic-data-types" accesskey="u" rel="up">Symbolic data types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Strings-1"></a>
<h3 class="section">8.1 Strings</h3>
<a name="index-string"></a>
<a name="index-cl_005fstring"></a>
<p>The class
</p>
<div class="example">
<pre class="example"> String
cl_string
<cln/string.h>
</pre></div>
<p>implements immutable strings.
</p>
<p>Strings are constructed through the following constructors:
</p>
<dl compact="compact">
<dt><code>cl_string (const char * s)</code></dt>
<dd><p>Returns an immutable copy of the (zero-terminated) C string <code>s</code>.
</p>
</dd>
<dt><code>cl_string (const char * ptr, unsigned long len)</code></dt>
<dd><p>Returns an immutable copy of the <code>len</code> characters at
<code>ptr[0]</code>, …, <code>ptr[len-1]</code>. NUL characters are allowed.
</p></dd>
</dl>
<p>The following functions are available on strings:
</p>
<dl compact="compact">
<dt><code>operator =</code></dt>
<dd><p>Assignment from <code>cl_string</code> and <code>const char *</code>.
</p>
</dd>
<dt><code>s.size()</code></dt>
<dd><a name="index-size_0028_0029"></a>
</dd>
<dt><code>strlen(s)</code></dt>
<dd><a name="index-strlen-_0028_0029"></a>
<p>Returns the length of the string <code>s</code>.
</p>
</dd>
<dt><code>s[i]</code></dt>
<dd><a name="index-operator-_005b_005d-_0028_0029"></a>
<p>Returns the <code>i</code>th character of the string <code>s</code>.
<code>i</code> must be in the range <code>0 <= i < s.size()</code>.
</p>
</dd>
<dt><code>bool equal (const cl_string& s1, const cl_string& s2)</code></dt>
<dd><a name="index-equal-_0028_0029-1"></a>
<p>Compares two strings for equality. One of the arguments may also be a
plain <code>const char *</code>.
</p></dd>
</dl>
<hr>
<a name="Symbols"></a>
<div class="header">
<p>
Previous: <a href="#Strings" accesskey="p" rel="prev">Strings</a>, Up: <a href="#Symbolic-data-types" accesskey="u" rel="up">Symbolic data types</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Symbols-1"></a>
<h3 class="section">8.2 Symbols</h3>
<a name="index-symbol"></a>
<a name="index-cl_005fsymbol"></a>
<p>Symbols are uniquified strings: all symbols with the same name are shared.
This means that comparison of two symbols is fast (effectively just a pointer
comparison), whereas comparison of two strings must in the worst case walk
both strings until their end.
Symbols are used, for example, as tags for properties, as names of variables
in polynomial rings, etc.
</p>
<p>Symbols are constructed through the following constructor:
</p>
<dl compact="compact">
<dt><code>cl_symbol (const cl_string& s)</code></dt>
<dd><p>Looks up or creates a new symbol with a given name.
</p></dd>
</dl>
<p>The following operations are available on symbols:
</p>
<dl compact="compact">
<dt><code>cl_string (const cl_symbol& sym)</code></dt>
<dd><p>Conversion to <code>cl_string</code>: Returns the string which names the symbol
<code>sym</code>.
</p>
</dd>
<dt><code>bool equal (const cl_symbol& sym1, const cl_symbol& sym2)</code></dt>
<dd><a name="index-equal-_0028_0029-2"></a>
<p>Compares two symbols for equality. This is very fast.
</p></dd>
</dl>
<hr>
<a name="Univariate-polynomials"></a>
<div class="header">
<p>
Next: <a href="#Internals" accesskey="n" rel="next">Internals</a>, Previous: <a href="#Symbolic-data-types" accesskey="p" rel="prev">Symbolic data types</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Univariate-polynomials-1"></a>
<h2 class="chapter">9 Univariate polynomials</h2>
<a name="index-polynomial"></a>
<a name="index-univariate-polynomial"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Univariate-polynomial-rings" accesskey="1">Univariate polynomial rings</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Functions-on-univariate-polynomials" accesskey="2">Functions on univariate polynomials</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Special-polynomials" accesskey="3">Special polynomials</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Univariate-polynomial-rings"></a>
<div class="header">
<p>
Next: <a href="#Functions-on-univariate-polynomials" accesskey="n" rel="next">Functions on univariate polynomials</a>, Up: <a href="#Univariate-polynomials" accesskey="u" rel="up">Univariate polynomials</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Univariate-polynomial-rings-1"></a>
<h3 class="section">9.1 Univariate polynomial rings</h3>
<p>CLN implements univariate polynomials (polynomials in one variable) over an
arbitrary ring. The indeterminate variable may be either unnamed (and will be
printed according to <code>default_print_flags.univpoly_varname</code>, which
defaults to ‘<samp>x</samp>’) or carry a given name. The base ring and the
indeterminate are explicitly part of every polynomial. CLN doesn’t allow you to
(accidentally) mix elements of different polynomial rings, e.g.
<code>(a^2+1) * (b^3-1)</code> will result in a runtime error. (Ideally this should
return a multivariate polynomial, but they are not yet implemented in CLN.)
</p>
<p>The classes of univariate polynomial rings are
</p>
<div class="example">
<pre class="example"> Ring
cl_ring
<cln/ring.h>
|
|
Univariate polynomial ring
cl_univpoly_ring
<cln/univpoly.h>
|
+----------------+-------------------+
| | |
Complex polynomial ring | Modular integer polynomial ring
cl_univpoly_complex_ring | cl_univpoly_modint_ring
<cln/univpoly_complex.h> | <cln/univpoly_modint.h>
|
+----------------+
| |
Real polynomial ring |
cl_univpoly_real_ring |
<cln/univpoly_real.h> |
|
+----------------+
| |
Rational polynomial ring |
cl_univpoly_rational_ring |
<cln/univpoly_rational.h> |
|
+----------------+
|
Integer polynomial ring
cl_univpoly_integer_ring
<cln/univpoly_integer.h>
</pre></div>
<p>and the corresponding classes of univariate polynomials are
</p>
<div class="example">
<pre class="example"> Univariate polynomial
cl_UP
<cln/univpoly.h>
|
+----------------+-------------------+
| | |
Complex polynomial | Modular integer polynomial
cl_UP_N | cl_UP_MI
<cln/univpoly_complex.h> | <cln/univpoly_modint.h>
|
+----------------+
| |
Real polynomial |
cl_UP_R |
<cln/univpoly_real.h> |
|
+----------------+
| |
Rational polynomial |
cl_UP_RA |
<cln/univpoly_rational.h> |
|
+----------------+
|
Integer polynomial
cl_UP_I
<cln/univpoly_integer.h>
</pre></div>
<p>Univariate polynomial rings are constructed using the functions
</p>
<dl compact="compact">
<dt><code>cl_univpoly_ring find_univpoly_ring (const cl_ring& R)</code></dt>
<dt><code>cl_univpoly_ring find_univpoly_ring (const cl_ring& R, const cl_symbol& varname)</code></dt>
<dd><p>This function returns the polynomial ring ‘<samp>R[X]</samp>’, unnamed or named.
<code>R</code> may be an arbitrary ring. This function takes care of finding out
about special cases of <code>R</code>, such as the rings of complex numbers,
real numbers, rational numbers, integers, or modular integer rings.
There is a cache table of rings, indexed by <code>R</code> and <code>varname</code>.
This ensures that two calls of this function with the same arguments will
return the same polynomial ring.
</p>
</dd>
<dt><code>cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R)</code></dt>
<dd><a name="index-find_005funivpoly_005fring-_0028_0029"></a>
</dd>
<dt><code>cl_univpoly_complex_ring find_univpoly_ring (const cl_complex_ring& R, const cl_symbol& varname)</code></dt>
<dt><code>cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R)</code></dt>
<dt><code>cl_univpoly_real_ring find_univpoly_ring (const cl_real_ring& R, const cl_symbol& varname)</code></dt>
<dt><code>cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R)</code></dt>
<dt><code>cl_univpoly_rational_ring find_univpoly_ring (const cl_rational_ring& R, const cl_symbol& varname)</code></dt>
<dt><code>cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R)</code></dt>
<dt><code>cl_univpoly_integer_ring find_univpoly_ring (const cl_integer_ring& R, const cl_symbol& varname)</code></dt>
<dt><code>cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R)</code></dt>
<dt><code>cl_univpoly_modint_ring find_univpoly_ring (const cl_modint_ring& R, const cl_symbol& varname)</code></dt>
<dd><p>These functions are equivalent to the general <code>find_univpoly_ring</code>,
only the return type is more specific, according to the base ring’s type.
</p></dd>
</dl>
<hr>
<a name="Functions-on-univariate-polynomials"></a>
<div class="header">
<p>
Next: <a href="#Special-polynomials" accesskey="n" rel="next">Special polynomials</a>, Previous: <a href="#Univariate-polynomial-rings" accesskey="p" rel="prev">Univariate polynomial rings</a>, Up: <a href="#Univariate-polynomials" accesskey="u" rel="up">Univariate polynomials</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-on-univariate-polynomials-1"></a>
<h3 class="section">9.2 Functions on univariate polynomials</h3>
<p>Given a univariate polynomial ring <code>R</code>, the following members can be used.
</p>
<dl compact="compact">
<dt><code>cl_ring R->basering()</code></dt>
<dd><a name="index-basering-_0028_0029"></a>
<p>This returns the base ring, as passed to ‘<samp>find_univpoly_ring</samp>’.
</p>
</dd>
<dt><code>cl_UP R->zero()</code></dt>
<dd><a name="index-zero-_0028_0029-2"></a>
<p>This returns <code>0 in R</code>, a polynomial of degree -1.
</p>
</dd>
<dt><code>cl_UP R->one()</code></dt>
<dd><a name="index-one-_0028_0029-2"></a>
<p>This returns <code>1 in R</code>, a polynomial of degree == 0.
</p>
</dd>
<dt><code>cl_UP R->canonhom (const cl_I& x)</code></dt>
<dd><a name="index-canonhom-_0028_0029-2"></a>
<p>This returns <code>x in R</code>, a polynomial of degree <= 0.
</p>
</dd>
<dt><code>cl_UP R->monomial (const cl_ring_element& x, uintL e)</code></dt>
<dd><a name="index-monomial-_0028_0029"></a>
<p>This returns a sparse polynomial: <code>x * X^e</code>, where <code>X</code> is the
indeterminate.
</p>
</dd>
<dt><code>cl_UP R->create (sintL degree)</code></dt>
<dd><a name="index-create-_0028_0029"></a>
<p>Creates a new polynomial with a given degree. The zero polynomial has degree
<code>-1</code>. After creating the polynomial, you should put in the coefficients,
using the <code>set_coeff</code> member function, and then call the <code>finalize</code>
member function.
</p></dd>
</dl>
<p>The following are the only destructive operations on univariate polynomials.
</p>
<dl compact="compact">
<dt><code>void set_coeff (cl_UP& x, uintL index, const cl_ring_element& y)</code></dt>
<dd><a name="index-set_005fcoeff-_0028_0029"></a>
<p>This changes the coefficient of <code>X^index</code> in <code>x</code> to be <code>y</code>.
After changing a polynomial and before applying any "normal" operation on it,
you should call its <code>finalize</code> member function.
</p>
</dd>
<dt><code>void finalize (cl_UP& x)</code></dt>
<dd><a name="index-finalize-_0028_0029"></a>
<p>This function marks the endpoint of destructive modifications of a polynomial.
It normalizes the internal representation so that subsequent computations have
less overhead. Doing normal computations on unnormalized polynomials may
produce wrong results or crash the program.
</p></dd>
</dl>
<p>The following operations are defined on univariate polynomials.
</p>
<dl compact="compact">
<dt><code>cl_univpoly_ring x.ring ()</code></dt>
<dd><a name="index-ring-_0028_0029-1"></a>
<p>Returns the ring to which the univariate polynomial <code>x</code> belongs.
</p>
</dd>
<dt><code>cl_UP operator+ (const cl_UP&, const cl_UP&)</code></dt>
<dd><a name="index-operator-_002b-_0028_0029-2"></a>
<p>Returns the sum of two univariate polynomials.
</p>
</dd>
<dt><code>cl_UP operator- (const cl_UP&, const cl_UP&)</code></dt>
<dd><a name="index-operator-_002d-_0028_0029-2"></a>
<p>Returns the difference of two univariate polynomials.
</p>
</dd>
<dt><code>cl_UP operator- (const cl_UP&)</code></dt>
<dd><p>Returns the negative of a univariate polynomial.
</p>
</dd>
<dt><code>cl_UP operator* (const cl_UP&, const cl_UP&)</code></dt>
<dd><a name="index-operator-_002a-_0028_0029-2"></a>
<p>Returns the product of two univariate polynomials. One of the arguments may
also be a plain integer or an element of the base ring.
</p>
</dd>
<dt><code>cl_UP square (const cl_UP&)</code></dt>
<dd><a name="index-square-_0028_0029-3"></a>
<p>Returns the square of a univariate polynomial.
</p>
</dd>
<dt><code>cl_UP expt_pos (const cl_UP& x, const cl_I& y)</code></dt>
<dd><a name="index-expt_005fpos-_0028_0029-3"></a>
<p><code>y</code> must be > 0. Returns <code>x^y</code>.
</p>
</dd>
<dt><code>bool operator== (const cl_UP&, const cl_UP&)</code></dt>
<dd><a name="index-operator-_003d_003d-_0028_0029-3"></a>
</dd>
<dt><code>bool operator!= (const cl_UP&, const cl_UP&)</code></dt>
<dd><a name="index-operator-_0021_003d-_0028_0029-3"></a>
<p>Compares two univariate polynomials, belonging to the same univariate
polynomial ring, for equality.
</p>
</dd>
<dt><code>bool zerop (const cl_UP& x)</code></dt>
<dd><a name="index-zerop-_0028_0029-3"></a>
<p>Returns true if <code>x</code> is <code>0 in R</code>.
</p>
</dd>
<dt><code>sintL degree (const cl_UP& x)</code></dt>
<dd><a name="index-degree-_0028_0029"></a>
<p>Returns the degree of the polynomial. The zero polynomial has degree <code>-1</code>.
</p>
</dd>
<dt><code>sintL ldegree (const cl_UP& x)</code></dt>
<dd><a name="index-degree-_0028_0029-1"></a>
<p>Returns the low degree of the polynomial. This is the degree of the first
non-vanishing polynomial coefficient. The zero polynomial has ldegree <code>-1</code>.
</p>
</dd>
<dt><code>cl_ring_element coeff (const cl_UP& x, uintL index)</code></dt>
<dd><a name="index-coeff-_0028_0029"></a>
<p>Returns the coefficient of <code>X^index</code> in the polynomial <code>x</code>.
</p>
</dd>
<dt><code>cl_ring_element x (const cl_ring_element& y)</code></dt>
<dd><a name="index-operator-_0028_0029-_0028_0029"></a>
<p>Evaluation: If <code>x</code> is a polynomial and <code>y</code> belongs to the base ring,
then ‘<samp>x(y)</samp>’ returns the value of the substitution of <code>y</code> into
<code>x</code>.
</p>
</dd>
<dt><code>cl_UP deriv (const cl_UP& x)</code></dt>
<dd><a name="index-deriv-_0028_0029"></a>
<p>Returns the derivative of the polynomial <code>x</code> with respect to the
indeterminate <code>X</code>.
</p></dd>
</dl>
<p>The following output functions are defined (see also the chapter on
input/output).
</p>
<dl compact="compact">
<dt><code>void fprint (std::ostream& stream, const cl_UP& x)</code></dt>
<dd><a name="index-fprint-_0028_0029-2"></a>
</dd>
<dt><code>std::ostream& operator<< (std::ostream& stream, const cl_UP& x)</code></dt>
<dd><a name="index-operator-_003c_003c-_0028_0029-3"></a>
<p>Prints the univariate polynomial <code>x</code> on the <code>stream</code>. The output may
depend on the global printer settings in the variable
<code>default_print_flags</code>.
</p></dd>
</dl>
<hr>
<a name="Special-polynomials"></a>
<div class="header">
<p>
Previous: <a href="#Functions-on-univariate-polynomials" accesskey="p" rel="prev">Functions on univariate polynomials</a>, Up: <a href="#Univariate-polynomials" accesskey="u" rel="up">Univariate polynomials</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Special-polynomials-1"></a>
<h3 class="section">9.3 Special polynomials</h3>
<p>The following functions return special polynomials.
</p>
<dl compact="compact">
<dt><code>cl_UP_I tschebychev (sintL n)</code></dt>
<dd><a name="index-tschebychev-_0028_0029"></a>
<a name="index-Chebyshev-polynomial"></a>
<p>Returns the n-th Chebyshev polynomial (n >= 0).
</p>
</dd>
<dt><code>cl_UP_I hermite (sintL n)</code></dt>
<dd><a name="index-hermite-_0028_0029"></a>
<a name="index-Hermite-polynomial"></a>
<p>Returns the n-th Hermite polynomial (n >= 0).
</p>
</dd>
<dt><code>cl_UP_RA legendre (sintL n)</code></dt>
<dd><a name="index-legendre-_0028_0029"></a>
<a name="index-Legende-polynomial"></a>
<p>Returns the n-th Legendre polynomial (n >= 0).
</p>
</dd>
<dt><code>cl_UP_I laguerre (sintL n)</code></dt>
<dd><a name="index-laguerre-_0028_0029"></a>
<a name="index-Laguerre-polynomial"></a>
<p>Returns the n-th Laguerre polynomial (n >= 0).
</p></dd>
</dl>
<p>Information how to derive the differential equation satisfied by each
of these polynomials from their definition can be found in the
<code>doc/polynomial/</code> directory.
</p>
<hr>
<a name="Internals"></a>
<div class="header">
<p>
Next: <a href="#Using-the-library" accesskey="n" rel="next">Using the library</a>, Previous: <a href="#Univariate-polynomials" accesskey="p" rel="prev">Univariate polynomials</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internals-1"></a>
<h2 class="chapter">10 Internals</h2>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Why-C_002b_002b-_003f" accesskey="1">Why C++ ?</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Memory-efficiency" accesskey="2">Memory efficiency</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Speed-efficiency" accesskey="3">Speed efficiency</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Garbage-collection" accesskey="4">Garbage collection</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Why-C_002b_002b-_003f"></a>
<div class="header">
<p>
Next: <a href="#Memory-efficiency" accesskey="n" rel="next">Memory efficiency</a>, Up: <a href="#Internals" accesskey="u" rel="up">Internals</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Why-C_002b_002b-_003f-1"></a>
<h3 class="section">10.1 Why C++ ?</h3>
<a name="index-advocacy"></a>
<p>Using C++ as an implementation language provides
</p>
<ul>
<li> Efficiency: It compiles to machine code.
</li><li> <a name="index-portability"></a>
Portability: It runs on all platforms supporting a C++ compiler. Because
of the availability of GNU C++, this includes all currently used 32-bit and
64-bit platforms, independently of the quality of the vendor’s C++ compiler.
</li><li> Type safety: The C++ compilers knows about the number types and complains if,
for example, you try to assign a float to an integer variable. However,
a drawback is that C++ doesn’t know about generic types, hence a restriction
like that <code>operator+ (const cl_MI&, const cl_MI&)</code> requires that both
arguments belong to the same modular ring cannot be expressed as a compile-time
information.
</li><li> Algebraic syntax: The elementary operations <code>+</code>, <code>-</code>, <code>*</code>,
<code>=</code>, <code>==</code>, ... can be used in infix notation, which is more
convenient than Lisp notation ‘<samp>(+ x y)</samp>’ or C notation ‘<samp>add(x,y,&z)</samp>’.
</li></ul>
<p>With these language features, there is no need for two separate languages,
one for the implementation of the library and one in which the library’s users
can program. This means that a prototype implementation of an algorithm
can be integrated into the library immediately after it has been tested and
debugged. No need to rewrite it in a low-level language after having prototyped
in a high-level language.
</p>
<hr>
<a name="Memory-efficiency"></a>
<div class="header">
<p>
Next: <a href="#Speed-efficiency" accesskey="n" rel="next">Speed efficiency</a>, Previous: <a href="#Why-C_002b_002b-_003f" accesskey="p" rel="prev">Why C++ ?</a>, Up: <a href="#Internals" accesskey="u" rel="up">Internals</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Memory-efficiency-1"></a>
<h3 class="section">10.2 Memory efficiency</h3>
<p>In order to save memory allocations, CLN implements:
</p>
<ul>
<li> Object sharing: An operation like <code>x+0</code> returns <code>x</code> without copying
it.
</li><li> <a name="index-garbage-collection"></a>
<a name="index-reference-counting"></a>
Garbage collection: A reference counting mechanism makes sure that any
number object’s storage is freed immediately when the last reference to the
object is gone.
</li><li> <a name="index-immediate-numbers-1"></a>
Small integers are represented as immediate values instead of pointers
to heap allocated storage. This means that integers <code>>= -2^29</code>,
<code>< 2^29</code> don’t consume heap memory, unless they were explicitly allocated
on the heap.
</li></ul>
<hr>
<a name="Speed-efficiency"></a>
<div class="header">
<p>
Next: <a href="#Garbage-collection" accesskey="n" rel="next">Garbage collection</a>, Previous: <a href="#Memory-efficiency" accesskey="p" rel="prev">Memory efficiency</a>, Up: <a href="#Internals" accesskey="u" rel="up">Internals</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Speed-efficiency-1"></a>
<h3 class="section">10.3 Speed efficiency</h3>
<p>Speed efficiency is obtained by the combination of the following tricks
and algorithms:
</p>
<ul>
<li> Small integers, being represented as immediate values, don’t require
memory access, just a couple of instructions for each elementary operation.
</li><li> The kernel of CLN has been written in assembly language for some CPUs
(<code>i386</code>, <code>m68k</code>, <code>sparc</code>, <code>mips</code>, <code>arm</code>).
</li><li> On all CPUs, CLN may be configured to use the superefficient low-level
routines from GNU GMP version 3.
</li><li> For large numbers, CLN uses, instead of the standard <code>O(N^2)</code>
algorithm, the Karatsuba multiplication, which is an
algorithm.
</li><li> For very large numbers (more than 12000 decimal digits), CLN uses
multiplication, which is an asymptotically optimal multiplication
algorithm.
</li><li> These fast multiplication algorithms also give improvements in the speed
of division and radix conversion.
</li></ul>
<hr>
<a name="Garbage-collection"></a>
<div class="header">
<p>
Previous: <a href="#Speed-efficiency" accesskey="p" rel="prev">Speed efficiency</a>, Up: <a href="#Internals" accesskey="u" rel="up">Internals</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Garbage-collection-1"></a>
<h3 class="section">10.4 Garbage collection</h3>
<a name="index-garbage-collection-1"></a>
<p>All the number classes are reference count classes: They only contain a pointer
to an object in the heap. Upon construction, assignment and destruction of
number objects, only the objects’ reference count are manipulated.
</p>
<p>Memory occupied by number objects are automatically reclaimed as soon as
their reference count drops to zero.
</p>
<p>For number rings, another strategy is implemented: There is a cache of,
for example, the modular integer rings. A modular integer ring is destroyed
only if its reference count dropped to zero and the cache is about to be
resized. The effect of this strategy is that recently used rings remain
cached, whereas undue memory consumption through cached rings is avoided.
</p>
<hr>
<a name="Using-the-library"></a>
<div class="header">
<p>
Next: <a href="#Customizing" accesskey="n" rel="next">Customizing</a>, Previous: <a href="#Internals" accesskey="p" rel="prev">Internals</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Using-the-library-1"></a>
<h2 class="chapter">11 Using the library</h2>
<p>For the following discussion, we will assume that you have installed
the CLN source in <code>$CLN_DIR</code> and built it in <code>$CLN_TARGETDIR</code>.
For example, for me it’s <code>CLN_DIR="$HOME/cln"</code> and
<code>CLN_TARGETDIR="$HOME/cln/linuxelf"</code>. You might define these as
environment variables, or directly substitute the appropriate values.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Compiler-options" accesskey="1">Compiler options</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Include-files" accesskey="2">Include files</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#An-Example" accesskey="3">An Example</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Debugging-support" accesskey="4">Debugging support</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Reporting-Problems" accesskey="5">Reporting Problems</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Compiler-options"></a>
<div class="header">
<p>
Next: <a href="#Include-files" accesskey="n" rel="next">Include files</a>, Up: <a href="#Using-the-library" accesskey="u" rel="up">Using the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compiler-options-1"></a>
<h3 class="section">11.1 Compiler options</h3>
<a name="index-compiler-options"></a>
<p>Until you have installed CLN in a public place, the following options are
needed:
</p>
<p>When you compile CLN application code, add the flags
</p><div class="example">
<pre class="example"> -I$CLN_DIR/include -I$CLN_TARGETDIR/include
</pre></div>
<p>to the C++ compiler’s command line (<code>make</code> variable CFLAGS or CXXFLAGS).
When you link CLN application code to form an executable, add the flags
</p><div class="example">
<pre class="example"> $CLN_TARGETDIR/src/libcln.a
</pre></div>
<p>to the C/C++ compiler’s command line (<code>make</code> variable LIBS).
</p>
<p>If you did a <code>make install</code>, the include files are installed in a
public directory (normally <code>/usr/local/include</code>), hence you don’t
need special flags for compiling. The library has been installed to a
public directory as well (normally <code>/usr/local/lib</code>), hence when
linking a CLN application it is sufficient to give the flag <code>-lcln</code>.
</p>
<a name="index-pkg_002dconfig"></a>
<p>To make the creation of software packages that use CLN easier, the
<code>pkg-config</code> utility can be used. CLN provides all the necessary
metainformation in a file called <code>cln.pc</code> (installed in
<code>/usr/local/lib/pkgconfig</code> by default). A program using CLN can
be compiled and linked using <a name="DOCF1" href="#FOOT1"><sup>1</sup></a>
</p><div class="example">
<pre class="example">g++ `pkg-config --libs cln` `pkg-config --cflags cln` prog.cc -o prog
</pre></div>
<p>Software using GNU autoconf can check for CLN with the
<code>PKG_CHECK_MODULES</code> macro supplied with <code>pkg-config</code>.
</p><div class="example">
<pre class="example">PKG_CHECK_MODULES([CLN], [cln >= <var>MIN-VERSION</var>])
</pre></div>
<p>This will check for CLN version at least <var>MIN-VERSION</var>. If the
required version was found, the variables <var>CLN_CFLAGS</var> and
<var>CLN_LIBS</var> are set. Otherwise the configure script aborts. If this
is not the desired behaviour, use the following code instead
<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>
</p><div class="example">
<pre class="example">PKG_CHECK_MODULES([CLN], [cln >= <var>MIN-VERSION</var>], [],
[AC_MSG_WARNING([No suitable version of CLN can be found])])
</pre></div>
<hr>
<a name="Include-files"></a>
<div class="header">
<p>
Next: <a href="#An-Example" accesskey="n" rel="next">An Example</a>, Previous: <a href="#Compiler-options" accesskey="p" rel="prev">Compiler options</a>, Up: <a href="#Using-the-library" accesskey="u" rel="up">Using the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Include-files-1"></a>
<h3 class="section">11.2 Include files</h3>
<a name="index-include-files"></a>
<a name="index-header-files"></a>
<p>Here is a summary of the include files and their contents.
</p>
<dl compact="compact">
<dt><code><cln/object.h></code></dt>
<dd><p>General definitions, reference counting, garbage collection.
</p></dd>
<dt><code><cln/number.h></code></dt>
<dd><p>The class cl_number.
</p></dd>
<dt><code><cln/complex.h></code></dt>
<dd><p>Functions for class cl_N, the complex numbers.
</p></dd>
<dt><code><cln/real.h></code></dt>
<dd><p>Functions for class cl_R, the real numbers.
</p></dd>
<dt><code><cln/float.h></code></dt>
<dd><p>Functions for class cl_F, the floats.
</p></dd>
<dt><code><cln/sfloat.h></code></dt>
<dd><p>Functions for class cl_SF, the short-floats.
</p></dd>
<dt><code><cln/ffloat.h></code></dt>
<dd><p>Functions for class cl_FF, the single-floats.
</p></dd>
<dt><code><cln/dfloat.h></code></dt>
<dd><p>Functions for class cl_DF, the double-floats.
</p></dd>
<dt><code><cln/lfloat.h></code></dt>
<dd><p>Functions for class cl_LF, the long-floats.
</p></dd>
<dt><code><cln/rational.h></code></dt>
<dd><p>Functions for class cl_RA, the rational numbers.
</p></dd>
<dt><code><cln/integer.h></code></dt>
<dd><p>Functions for class cl_I, the integers.
</p></dd>
<dt><code><cln/io.h></code></dt>
<dd><p>Input/Output.
</p></dd>
<dt><code><cln/complex_io.h></code></dt>
<dd><p>Input/Output for class cl_N, the complex numbers.
</p></dd>
<dt><code><cln/real_io.h></code></dt>
<dd><p>Input/Output for class cl_R, the real numbers.
</p></dd>
<dt><code><cln/float_io.h></code></dt>
<dd><p>Input/Output for class cl_F, the floats.
</p></dd>
<dt><code><cln/sfloat_io.h></code></dt>
<dd><p>Input/Output for class cl_SF, the short-floats.
</p></dd>
<dt><code><cln/ffloat_io.h></code></dt>
<dd><p>Input/Output for class cl_FF, the single-floats.
</p></dd>
<dt><code><cln/dfloat_io.h></code></dt>
<dd><p>Input/Output for class cl_DF, the double-floats.
</p></dd>
<dt><code><cln/lfloat_io.h></code></dt>
<dd><p>Input/Output for class cl_LF, the long-floats.
</p></dd>
<dt><code><cln/rational_io.h></code></dt>
<dd><p>Input/Output for class cl_RA, the rational numbers.
</p></dd>
<dt><code><cln/integer_io.h></code></dt>
<dd><p>Input/Output for class cl_I, the integers.
</p></dd>
<dt><code><cln/input.h></code></dt>
<dd><p>Flags for customizing input operations.
</p></dd>
<dt><code><cln/output.h></code></dt>
<dd><p>Flags for customizing output operations.
</p></dd>
<dt><code><cln/malloc.h></code></dt>
<dd><p><code>malloc_hook</code>, <code>free_hook</code>.
</p></dd>
<dt><code><cln/exception.h></code></dt>
<dd><p>Exception base class.
</p></dd>
<dt><code><cln/condition.h></code></dt>
<dd><p>Conditions.
</p></dd>
<dt><code><cln/string.h></code></dt>
<dd><p>Strings.
</p></dd>
<dt><code><cln/symbol.h></code></dt>
<dd><p>Symbols.
</p></dd>
<dt><code><cln/proplist.h></code></dt>
<dd><p>Property lists.
</p></dd>
<dt><code><cln/ring.h></code></dt>
<dd><p>General rings.
</p></dd>
<dt><code><cln/null_ring.h></code></dt>
<dd><p>The null ring.
</p></dd>
<dt><code><cln/complex_ring.h></code></dt>
<dd><p>The ring of complex numbers.
</p></dd>
<dt><code><cln/real_ring.h></code></dt>
<dd><p>The ring of real numbers.
</p></dd>
<dt><code><cln/rational_ring.h></code></dt>
<dd><p>The ring of rational numbers.
</p></dd>
<dt><code><cln/integer_ring.h></code></dt>
<dd><p>The ring of integers.
</p></dd>
<dt><code><cln/numtheory.h></code></dt>
<dd><p>Number threory functions.
</p></dd>
<dt><code><cln/modinteger.h></code></dt>
<dd><p>Modular integers.
</p></dd>
<dt><code><cln/V.h></code></dt>
<dd><p>Vectors.
</p></dd>
<dt><code><cln/GV.h></code></dt>
<dd><p>General vectors.
</p></dd>
<dt><code><cln/GV_number.h></code></dt>
<dd><p>General vectors over cl_number.
</p></dd>
<dt><code><cln/GV_complex.h></code></dt>
<dd><p>General vectors over cl_N.
</p></dd>
<dt><code><cln/GV_real.h></code></dt>
<dd><p>General vectors over cl_R.
</p></dd>
<dt><code><cln/GV_rational.h></code></dt>
<dd><p>General vectors over cl_RA.
</p></dd>
<dt><code><cln/GV_integer.h></code></dt>
<dd><p>General vectors over cl_I.
</p></dd>
<dt><code><cln/GV_modinteger.h></code></dt>
<dd><p>General vectors of modular integers.
</p></dd>
<dt><code><cln/SV.h></code></dt>
<dd><p>Simple vectors.
</p></dd>
<dt><code><cln/SV_number.h></code></dt>
<dd><p>Simple vectors over cl_number.
</p></dd>
<dt><code><cln/SV_complex.h></code></dt>
<dd><p>Simple vectors over cl_N.
</p></dd>
<dt><code><cln/SV_real.h></code></dt>
<dd><p>Simple vectors over cl_R.
</p></dd>
<dt><code><cln/SV_rational.h></code></dt>
<dd><p>Simple vectors over cl_RA.
</p></dd>
<dt><code><cln/SV_integer.h></code></dt>
<dd><p>Simple vectors over cl_I.
</p></dd>
<dt><code><cln/SV_ringelt.h></code></dt>
<dd><p>Simple vectors of general ring elements.
</p></dd>
<dt><code><cln/univpoly.h></code></dt>
<dd><p>Univariate polynomials.
</p></dd>
<dt><code><cln/univpoly_integer.h></code></dt>
<dd><p>Univariate polynomials over the integers.
</p></dd>
<dt><code><cln/univpoly_rational.h></code></dt>
<dd><p>Univariate polynomials over the rational numbers.
</p></dd>
<dt><code><cln/univpoly_real.h></code></dt>
<dd><p>Univariate polynomials over the real numbers.
</p></dd>
<dt><code><cln/univpoly_complex.h></code></dt>
<dd><p>Univariate polynomials over the complex numbers.
</p></dd>
<dt><code><cln/univpoly_modint.h></code></dt>
<dd><p>Univariate polynomials over modular integer rings.
</p></dd>
<dt><code><cln/timing.h></code></dt>
<dd><p>Timing facilities.
</p></dd>
<dt><code><cln/cln.h></code></dt>
<dd><p>Includes all of the above.
</p></dd>
</dl>
<hr>
<a name="An-Example"></a>
<div class="header">
<p>
Next: <a href="#Debugging-support" accesskey="n" rel="next">Debugging support</a>, Previous: <a href="#Include-files" accesskey="p" rel="prev">Include files</a>, Up: <a href="#Using-the-library" accesskey="u" rel="up">Using the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="An-Example-1"></a>
<h3 class="section">11.3 An Example</h3>
<p>A function which computes the nth Fibonacci number can be written as follows.
<a name="index-Fibonacci-number"></a>
</p>
<div class="example">
<pre class="example">#include <cln/integer.h>
#include <cln/real.h>
using namespace cln;
// Returns F_n, computed as the nearest integer to
// ((1+sqrt(5))/2)^n/sqrt(5). Assume n>=0.
const cl_I fibonacci (int n)
{
// Need a precision of ((1+sqrt(5))/2)^-n.
float_format_t prec = float_format((int)(0.208987641*n+5));
cl_R sqrt5 = sqrt(cl_float(5,prec));
cl_R phi = (1+sqrt5)/2;
return round1( expt(phi,n)/sqrt5 );
}
</pre></div>
<p>Let’s explain what is going on in detail.
</p>
<p>The include file <code><cln/integer.h></code> is necessary because the type
<code>cl_I</code> is used in the function, and the include file <code><cln/real.h></code>
is needed for the type <code>cl_R</code> and the floating point number functions.
The order of the include files does not matter. In order not to write
out <code>cln::</code><var>foo</var> in this simple example we can safely import
the whole namespace <code>cln</code>.
</p>
<p>Then comes the function declaration. The argument is an <code>int</code>, the
result an integer. The return type is defined as ‘<samp>const cl_I</samp>’, not
simply ‘<samp>cl_I</samp>’, because that allows the compiler to detect typos like
‘<samp>fibonacci(n) = 100</samp>’. It would be possible to declare the return
type as <code>const cl_R</code> (real number) or even <code>const cl_N</code> (complex
number). We use the most specialized possible return type because functions
which call ‘<samp>fibonacci</samp>’ will be able to profit from the compiler’s type
analysis: Adding two integers is slightly more efficient than adding the
same objects declared as complex numbers, because it needs less type
dispatch. Also, when linking to CLN as a non-shared library, this minimizes
the size of the resulting executable program.
</p>
<p>The result will be computed as expt(phi,n)/sqrt(5), rounded to the nearest
integer. In order to get a correct result, the absolute error should be less
than 1/2, i.e. the relative error should be less than sqrt(5)/(2*expt(phi,n)).
To this end, the first line computes a floating point precision for sqrt(5)
and phi.
</p>
<p>Then sqrt(5) is computed by first converting the integer 5 to a floating point
number and than taking the square root. The converse, first taking the square
root of 5, and then converting to the desired precision, would not work in
CLN: The square root would be computed to a default precision (normally
single-float precision), and the following conversion could not help about
the lacking accuracy. This is because CLN is not a symbolic computer algebra
system and does not represent sqrt(5) in a non-numeric way.
</p>
<p>The type <code>cl_R</code> for sqrt5 and, in the following line, phi is the only
possible choice. You cannot write <code>cl_F</code> because the C++ compiler can
only infer that <code>cl_float(5,prec)</code> is a real number. You cannot write
<code>cl_N</code> because a ‘<samp>round1</samp>’ does not exist for general complex
numbers.
</p>
<p>When the function returns, all the local variables in the function are
automatically reclaimed (garbage collected). Only the result survives and
gets passed to the caller.
</p>
<p>The file <code>fibonacci.cc</code> in the subdirectory <code>examples</code>
contains this implementation together with an even faster algorithm.
</p>
<hr>
<a name="Debugging-support"></a>
<div class="header">
<p>
Next: <a href="#Reporting-Problems" accesskey="n" rel="next">Reporting Problems</a>, Previous: <a href="#An-Example" accesskey="p" rel="prev">An Example</a>, Up: <a href="#Using-the-library" accesskey="u" rel="up">Using the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugging-support-1"></a>
<h3 class="section">11.4 Debugging support</h3>
<a name="index-debugging"></a>
<p>When debugging a CLN application with GNU <code>gdb</code>, two facilities are
available from the library:
</p>
<ul>
<li> The library does type checks, range checks, consistency checks at
many places. When one of these fails, an exception of a type derived from
<code>runtime_exception</code> is thrown. When an exception is cought, the stack
has already been unwound, so it is may not be possible to tell at which
point the exception was thrown. For debugging, it is best to set up a
catchpoint at the event of throwning a C++ exception:
<div class="example">
<pre class="example">(gdb) catch throw
</pre></div>
<p>When this catchpoint is hit, look at the stack’s backtrace:
</p><div class="example">
<pre class="example">(gdb) where
</pre></div>
<p>When control over the type of exception is required, it may be possible
to set a breakpoint at the <code>g++</code> runtime library function
<code>__raise_exception</code>. Refer to the documentation of GNU <code>gdb</code>
for details.
</p>
</li><li> The debugger’s normal <code>print</code> command doesn’t know about
CLN’s types and therefore prints mostly useless hexadecimal addresses.
CLN offers a function <code>cl_print</code>, callable from the debugger,
for printing number objects. In order to get this function, you have
to define the macro ‘<samp>CL_DEBUG</samp>’ and then include all the header files
for which you want <code>cl_print</code> debugging support. For example:
<a name="index-CL_005fDEBUG"></a>
<div class="example">
<pre class="example">#define CL_DEBUG
#include <cln/string.h>
</pre></div>
<p>Now, if you have in your program a variable <code>cl_string s</code>, and
inspect it under <code>gdb</code>, the output may look like this:
</p><div class="example">
<pre class="example">(gdb) print s
$7 = {<cl_gcpointer> = { = {pointer = 0x8055b60, heappointer = 0x8055b60,
word = 134568800}}, }
(gdb) call cl_print(s)
(cl_string) ""
$8 = 134568800
</pre></div>
<p>Note that the output of <code>cl_print</code> goes to the program’s error output,
not to gdb’s standard output.
</p>
<p>Note, however, that the above facility does not work with all CLN types,
only with number objects and similar. Therefore CLN offers a member function
<code>debug_print()</code> on all CLN types. The same macro ‘<samp>CL_DEBUG</samp>’
is needed for this member function to be implemented. Under <code>gdb</code>,
you call it like this:
<a name="index-debug_005fprint-_0028_0029"></a>
</p><div class="example">
<pre class="example">(gdb) print s
$7 = {<cl_gcpointer> = { = {pointer = 0x8055b60, heappointer = 0x8055b60,
word = 134568800}}, }
(gdb) call s.debug_print()
(cl_string) ""
(gdb) define cprint
>call ($1).debug_print()
>end
(gdb) cprint s
(cl_string) ""
</pre></div>
<p>Unfortunately, this feature does not seem to work under all circumstances.
</p></li></ul>
<hr>
<a name="Reporting-Problems"></a>
<div class="header">
<p>
Previous: <a href="#Debugging-support" accesskey="p" rel="prev">Debugging support</a>, Up: <a href="#Using-the-library" accesskey="u" rel="up">Using the library</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Reporting-Problems-1"></a>
<h3 class="section">11.5 Reporting Problems</h3>
<a name="index-bugreports"></a>
<a name="index-mailing-list"></a>
<p>If you encounter any problem, please don’t hesitate to send a detailed
bugreport to the <code>cln-list@ginac.de</code> mailing list. Please think
about your bug: consider including a short description of your operating
system and compilation environment with corresponding version numbers. A
description of your configuration options may also be helpful. Also, a
short test program together with the output you get and the output you
expect will help us to reproduce it quickly. Finally, do not forget to
report the version number of CLN.
</p>
<hr>
<a name="Customizing"></a>
<div class="header">
<p>
Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Using-the-library" accesskey="p" rel="prev">Using the library</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Customizing-1"></a>
<h2 class="chapter">12 Customizing</h2>
<a name="index-customizing"></a>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#Error-handling" accesskey="1">Error handling</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Floating_002dpoint-underflow" accesskey="2">Floating-point underflow</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Customizing-I_002fO" accesskey="3">Customizing I/O</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">• <a href="#Customizing-the-memory-allocator" accesskey="4">Customizing the memory allocator</a>:</td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Error-handling"></a>
<div class="header">
<p>
Next: <a href="#Floating_002dpoint-underflow" accesskey="n" rel="next">Floating-point underflow</a>, Up: <a href="#Customizing" accesskey="u" rel="up">Customizing</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Error-handling-1"></a>
<h3 class="section">12.1 Error handling</h3>
<a name="index-exception"></a>
<a name="index-error-handling"></a>
<a name="index-runtime_005fexception"></a>
<p>CLN signals abnormal situations by throwning exceptions. All exceptions
thrown by the library are of type <code>runtime_exception</code> or of a
derived type. Class <code>cln::runtime_exception</code> in turn is derived
from the C++ standard library class <code>std::runtime_error</code> and
inherits the <code>.what()</code> member function that can be used to query
details about the cause of error.
</p>
<p>The most important classes thrown by the library are
</p>
<a name="index-floating_005fpoint_005fexception"></a>
<a name="index-read_005fnumber_005fexception"></a>
<div class="example">
<pre class="example"> Exception base class
runtime_exception
<cln/exception.h>
|
+----------------+----------------+
| |
Malformed number input Floating-point error
read_number_exception floating_poing_exception
<cln/number_io.h> <cln/float.h>
</pre></div>
<p>CLN has many more exception classes that allow for more fine-grained
control but I refrain from documenting them all here. They are all
declared in the public header files and they are all subclasses of the
above exceptions, so catching those you are always on the safe side.
</p>
<hr>
<a name="Floating_002dpoint-underflow"></a>
<div class="header">
<p>
Next: <a href="#Customizing-I_002fO" accesskey="n" rel="next">Customizing I/O</a>, Previous: <a href="#Error-handling" accesskey="p" rel="prev">Error handling</a>, Up: <a href="#Customizing" accesskey="u" rel="up">Customizing</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Floating_002dpoint-underflow-1"></a>
<h3 class="section">12.2 Floating-point underflow</h3>
<a name="index-underflow"></a>
<a name="index-floating_005fpoint_005funderflow_005fexception"></a>
<p>Floating point underflow denotes the situation when a floating-point
number is to be created which is so close to <code>0</code> that its exponent
is too low to be represented internally. By default, this causes the
exception <code>floating_point_underflow_exception</code> (subclass of
<code>floating_point_exception</code>) to be thrown. If you set the global
variable
</p><div class="example">
<pre class="example">bool cl_inhibit_floating_point_underflow
</pre></div>
<p>to <code>true</code>, the exception will be inhibited, and a floating-point
zero will be generated instead. The default value of
<code>cl_inhibit_floating_point_underflow</code> is <code>false</code>.
</p>
<hr>
<a name="Customizing-I_002fO"></a>
<div class="header">
<p>
Next: <a href="#Customizing-the-memory-allocator" accesskey="n" rel="next">Customizing the memory allocator</a>, Previous: <a href="#Floating_002dpoint-underflow" accesskey="p" rel="prev">Floating-point underflow</a>, Up: <a href="#Customizing" accesskey="u" rel="up">Customizing</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Customizing-I_002fO-1"></a>
<h3 class="section">12.3 Customizing I/O</h3>
<p>The output of the function <code>fprint</code> may be customized by changing the
value of the global variable <code>default_print_flags</code>.
<a name="index-default_005fprint_005fflags"></a>
</p>
<hr>
<a name="Customizing-the-memory-allocator"></a>
<div class="header">
<p>
Previous: <a href="#Customizing-I_002fO" accesskey="p" rel="prev">Customizing I/O</a>, Up: <a href="#Customizing" accesskey="u" rel="up">Customizing</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Customizing-the-memory-allocator-1"></a>
<h3 class="section">12.4 Customizing the memory allocator</h3>
<p>Every memory allocation of CLN is done through the function pointer
<code>malloc_hook</code>. Freeing of this memory is done through the function
pointer <code>free_hook</code>. The default versions of these functions,
provided in the library, call <code>malloc</code> and <code>free</code> and check
the <code>malloc</code> result against <code>NULL</code>.
If you want to provide another memory allocator, you need to define
the variables <code>malloc_hook</code> and <code>free_hook</code> yourself,
like this:
</p><div class="example">
<pre class="example">#include <cln/malloc.h>
namespace cln {
void* (*malloc_hook) (size_t size) = …;
void (*free_hook) (void* ptr) = …;
}
</pre></div>
<a name="index-malloc_005fhook-_0028_0029"></a>
<a name="index-free_005fhook-_0028_0029"></a>
<p>The <code>cl_malloc_hook</code> function must not return a <code>NULL</code> pointer.
</p>
<p>It is not possible to change the memory allocator at runtime, because
it is already called at program startup by the constructors of some
global variables.
</p>
<hr>
<a name="Index"></a>
<div class="header">
<p>
Previous: <a href="#Customizing" accesskey="p" rel="prev">Customizing</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Index-1"></a>
<h2 class="unnumbered">Index</h2>
<table><tr><th valign="top">Jump to: </th><td><a class="summary-letter" href="#Index_my_letter-A"><b>A</b></a>
<a class="summary-letter" href="#Index_my_letter-B"><b>B</b></a>
<a class="summary-letter" href="#Index_my_letter-C"><b>C</b></a>
<a class="summary-letter" href="#Index_my_letter-D"><b>D</b></a>
<a class="summary-letter" href="#Index_my_letter-E"><b>E</b></a>
<a class="summary-letter" href="#Index_my_letter-F"><b>F</b></a>
<a class="summary-letter" href="#Index_my_letter-G"><b>G</b></a>
<a class="summary-letter" href="#Index_my_letter-H"><b>H</b></a>
<a class="summary-letter" href="#Index_my_letter-I"><b>I</b></a>
<a class="summary-letter" href="#Index_my_letter-J"><b>J</b></a>
<a class="summary-letter" href="#Index_my_letter-L"><b>L</b></a>
<a class="summary-letter" href="#Index_my_letter-M"><b>M</b></a>
<a class="summary-letter" href="#Index_my_letter-N"><b>N</b></a>
<a class="summary-letter" href="#Index_my_letter-O"><b>O</b></a>
<a class="summary-letter" href="#Index_my_letter-P"><b>P</b></a>
<a class="summary-letter" href="#Index_my_letter-R"><b>R</b></a>
<a class="summary-letter" href="#Index_my_letter-S"><b>S</b></a>
<a class="summary-letter" href="#Index_my_letter-T"><b>T</b></a>
<a class="summary-letter" href="#Index_my_letter-U"><b>U</b></a>
<a class="summary-letter" href="#Index_my_letter-X"><b>X</b></a>
<a class="summary-letter" href="#Index_my_letter-Z"><b>Z</b></a>
</td></tr></table>
<table class="index-my" border="0">
<tr><td></td><th align="left">Index Entry</th><td> </td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-abs-_0028_0029"><code>abs ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-abstract-class">abstract class</a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-acos-_0028_0029"><code>acos ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-acosh-_0028_0029"><code>acosh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-advocacy">advocacy</a>:</td><td> </td><td valign="top"><a href="#Why-C_002b_002b-_003f">Why C++ ?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Archimedes_0027-constant">Archimedes’ constant</a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-As_0028_0029_0028_0029"><code>As()()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ash-_0028_0029"><code>ash ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-asin"><code>asin</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-asin-_0028_0029"><code>asin ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-asinh-_0028_0029"><code>asinh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atan"><code>atan</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atan-_0028_0029"><code>atan ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atanh-_0028_0029"><code>atanh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-basering-_0028_0029"><code>basering ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-binary-splitting">binary splitting</a>:</td><td> </td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-binomial-_0028_0029"><code>binomial ()</code></a>:</td><td> </td><td valign="top"><a href="#Combinatorial-functions">Combinatorial functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole-_0028_0029"><code>boole ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005f1"><code>boole_1</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005f2"><code>boole_2</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fand"><code>boole_and</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fandc1"><code>boole_andc1</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fandc2"><code>boole_andc2</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fc1"><code>boole_c1</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fc2"><code>boole_c2</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fclr"><code>boole_clr</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005feqv"><code>boole_eqv</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fnand"><code>boole_nand</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fnor"><code>boole_nor</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005forc1"><code>boole_orc1</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005forc2"><code>boole_orc2</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fset"><code>boole_set</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-boole_005fxor"><code>boole_xor</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bugreports">bugreports</a>:</td><td> </td><td valign="top"><a href="#Reporting-Problems">Reporting Problems</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-canonhom-_0028_0029"><code>canonhom ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-canonhom-_0028_0029-1"><code>canonhom ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-canonhom-_0028_0029-2"><code>canonhom ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cast">cast</a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Catalan_0027s-constant">Catalan’s constant</a>:</td><td> </td><td valign="top"><a href="#Euler-gamma">Euler gamma</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-catalanconst-_0028_0029"><code>catalanconst ()</code></a>:</td><td> </td><td valign="top"><a href="#Euler-gamma">Euler gamma</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ceiling1-_0028_0029"><code>ceiling1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ceiling2-_0028_0029"><code>ceiling2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Chebyshev-polynomial">Chebyshev polynomial</a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cis-_0028_0029"><code>cis ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fbyte"><code>cl_byte</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CL_005fDEBUG"><code>CL_DEBUG</code></a>:</td><td> </td><td valign="top"><a href="#Debugging-support">Debugging support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fDF"><code>cl_DF</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fDF_005ffdiv_005ft"><code>cl_DF_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fF"><code>cl_F</code></a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fF-1"><code>cl_F</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fFF"><code>cl_FF</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fFF_005ffdiv_005ft"><code>cl_FF_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005ffloat-_0028_0029"><code>cl_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fF_005ffdiv_005ft"><code>cl_F_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fidecoded_005ffloat"><code>cl_idecoded_float</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fI_005fto_005fint-_0028_0029"><code>cl_I_to_int ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fI_005fto_005flong-_0028_0029"><code>cl_I_to_long ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fI_005fto_005fuint-_0028_0029"><code>cl_I_to_uint ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fI_005fto_005fulong-_0028_0029"><code>cl_I_to_ulong ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fLF"><code>cl_LF</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fLF_005ffdiv_005ft"><code>cl_LF_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fmodint_005fring"><code>cl_modint_ring</code></a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fN"><code>cl_N</code></a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fnumber"><code>cl_number</code></a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fR"><code>cl_R</code></a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fRA"><code>cl_RA</code></a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fR_005ffdiv_005ft"><code>cl_R_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fSF"><code>cl_SF</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fSF_005ffdiv_005ft"><code>cl_SF_fdiv_t</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fstring"><code>cl_string</code></a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cl_005fsymbol"><code>cl_symbol</code></a>:</td><td> </td><td valign="top"><a href="#Symbols">Symbols</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-coeff-_0028_0029"><code>coeff ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compare-_0028_0029"><code>compare ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-comparison">comparison</a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler-options">compiler options</a>:</td><td> </td><td valign="top"><a href="#Compiler-options">Compiler options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-complex-_0028_0029"><code>complex ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-complex-functions">Elementary complex functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-complex-number">complex number</a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-complex-number-1">complex number</a>:</td><td> </td><td valign="top"><a href="#Complex-numbers">Complex numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conjugate-_0028_0029"><code>conjugate ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-complex-functions">Elementary complex functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conversion">conversion</a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conversion-1">conversion</a>:</td><td> </td><td valign="top"><a href="#Conversion-functions">Conversion functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cos-_0028_0029"><code>cos ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cosh-_0028_0029"><code>cosh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cosh_005fsinh-_0028_0029"><code>cosh_sinh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cosh_005fsinh_005ft"><code>cosh_sinh_t</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cos_005fsin-_0028_0029"><code>cos_sin ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cos_005fsin_005ft"><code>cos_sin_t</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-create-_0028_0029"><code>create ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-customizing">customizing</a>:</td><td> </td><td valign="top"><a href="#Customizing">Customizing</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-debugging">debugging</a>:</td><td> </td><td valign="top"><a href="#Debugging-support">Debugging support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debug_005fprint-_0028_0029"><code>debug_print ()</code></a>:</td><td> </td><td valign="top"><a href="#Debugging-support">Debugging support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decoded_005fdfloat"><code>decoded_dfloat</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decoded_005fffloat"><code>decoded_ffloat</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decoded_005ffloat"><code>decoded_float</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decoded_005flfloat"><code>decoded_lfloat</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decoded_005fsfloat"><code>decoded_sfloat</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-decode_005ffloat-_0028_0029"><code>decode_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-default_005ffloat_005fformat"><code>default_float_format</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-default_005fprint_005fflags"><code>default_print_flags</code></a>:</td><td> </td><td valign="top"><a href="#Customizing-I_002fO">Customizing I/O</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-default_005frandom_005fstate"><code>default_random_state</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-degree-_0028_0029"><code>degree ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-degree-_0028_0029-1"><code>degree ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-denominator-_0028_0029"><code>denominator ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-rational-functions">Elementary rational functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deposit_005ffield-_0028_0029"><code>deposit_field ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deriv-_0028_0029"><code>deriv ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-div-_0028_0029"><code>div ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-doublefactorial-_0028_0029"><code>doublefactorial ()</code></a>:</td><td> </td><td valign="top"><a href="#Combinatorial-functions">Combinatorial functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-double_005fapprox-_0028_0029"><code>double_approx ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dpb-_0028_0029"><code>dpb ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-equal-_0028_0029"><code>equal ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-equal-_0028_0029-1"><code>equal ()</code></a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-equal-_0028_0029-2"><code>equal ()</code></a>:</td><td> </td><td valign="top"><a href="#Symbols">Symbols</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-equal_005fhashcode-_0028_0029"><code>equal_hashcode ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-handling">error handling</a>:</td><td> </td><td valign="top"><a href="#Error-handling">Error handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Euler_0027s-constant">Euler’s constant</a>:</td><td> </td><td valign="top"><a href="#Euler-gamma">Euler gamma</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eulerconst-_0028_0029"><code>eulerconst ()</code></a>:</td><td> </td><td valign="top"><a href="#Euler-gamma">Euler gamma</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-evenp-_0028_0029"><code>evenp ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exact-number">exact number</a>:</td><td> </td><td valign="top"><a href="#Exact-numbers">Exact numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exception">exception</a>:</td><td> </td><td valign="top"><a href="#Error-handling">Error handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exp-_0028_0029"><code>exp ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exp1-_0028_0029"><code>exp1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt-_0028_0029"><code>expt ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt-_0028_0029-1"><code>expt ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt-_0028_0029-2"><code>expt ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt_005fpos-_0028_0029"><code>expt_pos ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt_005fpos-_0028_0029-1"><code>expt_pos ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt_005fpos-_0028_0029-2"><code>expt_pos ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expt_005fpos-_0028_0029-3"><code>expt_pos ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exquo-_0028_0029"><code>exquo ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-factorial-_0028_0029"><code>factorial ()</code></a>:</td><td> </td><td valign="top"><a href="#Combinatorial-functions">Combinatorial functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fceiling-_0028_0029"><code>fceiling ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fceiling2-_0028_0029"><code>fceiling2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ffloor-_0028_0029"><code>ffloor ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ffloor2-_0028_0029"><code>ffloor2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Fibonacci-number">Fibonacci number</a>:</td><td> </td><td valign="top"><a href="#An-Example">An Example</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-finalize-_0028_0029"><code>finalize ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find_005fmodint_005fring-_0028_0029"><code>find_modint_ring ()</code></a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find_005funivpoly_005fring-_0028_0029"><code>find_univpoly_ring ()</code></a>:</td><td> </td><td valign="top"><a href="#Univariate-polynomial-rings">Univariate polynomial rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floating_002dpoint-number">floating-point number</a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floating_005fpoint_005fexception"><code>floating_point_exception</code></a>:</td><td> </td><td valign="top"><a href="#Error-handling">Error handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floating_005fpoint_005funderflow_005fexception"><code>floating_point_underflow_exception</code></a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-underflow">Floating-point underflow</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fapprox-_0028_0029"><code>float_approx ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fdigits-_0028_0029"><code>float_digits ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fepsilon-_0028_0029"><code>float_epsilon ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fexponent-_0028_0029"><code>float_exponent ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fformat-_0028_0029"><code>float_format ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fformat_005ft"><code>float_format_t</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fnegative_005fepsilon-_0028_0029"><code>float_negative_epsilon ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fprecision-_0028_0029"><code>float_precision ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fradix-_0028_0029"><code>float_radix ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fsign-_0028_0029"><code>float_sign ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-float_005fsign-_0028_0029-1"><code>float_sign ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floor1-_0028_0029"><code>floor1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-floor2-_0028_0029"><code>floor2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fprint-_0028_0029"><code>fprint ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fprint-_0028_0029-1"><code>fprint ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fprint-_0028_0029-2"><code>fprint ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-free_005fhook-_0028_0029"><code>free_hook ()</code></a>:</td><td> </td><td valign="top"><a href="#Customizing-the-memory-allocator">Customizing the memory allocator</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fround-_0028_0029"><code>fround ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fround2-_0028_0029"><code>fround2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ftruncate-_0028_0029"><code>ftruncate ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ftruncate2-_0028_0029"><code>ftruncate2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-garbage-collection">garbage collection</a>:</td><td> </td><td valign="top"><a href="#Memory-efficiency">Memory efficiency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-garbage-collection-1">garbage collection</a>:</td><td> </td><td valign="top"><a href="#Garbage-collection">Garbage collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gcd-_0028_0029"><code>gcd ()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GMP">GMP</a>:</td><td> </td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GMP-1">GMP</a>:</td><td> </td><td valign="top"><a href="#Using-the-GNU-MP-Library">Using the GNU MP Library</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-header-files">header files</a>:</td><td> </td><td valign="top"><a href="#Include-files">Include files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hermite-_0028_0029"><code>hermite ()</code></a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Hermite-polynomial">Hermite polynomial</a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-imagpart-_0028_0029"><code>imagpart ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-complex-functions">Elementary complex functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-immediate-numbers">immediate numbers</a>:</td><td> </td><td valign="top"><a href="#Exact-numbers">Exact numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-immediate-numbers-1">immediate numbers</a>:</td><td> </td><td valign="top"><a href="#Memory-efficiency">Memory efficiency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-include-files">include files</a>:</td><td> </td><td valign="top"><a href="#Include-files">Include files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Input_002fOutput">Input/Output</a>:</td><td> </td><td valign="top"><a href="#Input_002fOutput">Input/Output</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-installation">installation</a>:</td><td> </td><td valign="top"><a href="#Installing-the-library">Installing the library</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-instanceof-_0028_0029"><code>instanceof ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer">integer</a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_005fdecode_005ffloat-_0028_0029"><code>integer_decode_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-integer_005flength-_0028_0029"><code>integer_length ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-isprobprime_0028_0029"><code>isprobprime()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-isqrt-_0028_0029"><code>isqrt ()</code></a>:</td><td> </td><td valign="top"><a href="#Roots">Roots</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-J">J</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-jacobi_0028_0029"><code>jacobi()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-laguerre-_0028_0029"><code>laguerre ()</code></a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Laguerre-polynomial">Laguerre polynomial</a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lcm-_0028_0029"><code>lcm ()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb-_0028_0029"><code>ldb ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb_005ftest-_0028_0029"><code>ldb_test ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-least_005fnegative_005ffloat-_0028_0029"><code>least_negative_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-least_005fpositive_005ffloat-_0028_0029"><code>least_positive_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Legende-polynomial">Legende polynomial</a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-legendre-_0028_0029"><code>legendre ()</code></a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ln-_0028_0029"><code>ln ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-log-_0028_0029"><code>log ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logand-_0028_0029"><code>logand ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logandc1-_0028_0029"><code>logandc1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logandc2-_0028_0029"><code>logandc2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logbitp-_0028_0029"><code>logbitp ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logcount-_0028_0029"><code>logcount ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logeqv-_0028_0029"><code>logeqv ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logior-_0028_0029"><code>logior ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lognand-_0028_0029"><code>lognand ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lognor-_0028_0029"><code>lognor ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lognot-_0028_0029"><code>lognot ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logorc1-_0028_0029"><code>logorc1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logorc2-_0028_0029"><code>logorc2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logp-_0028_0029"><code>logp ()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logtest-_0028_0029"><code>logtest ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logxor-_0028_0029"><code>logxor ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailing-list">mailing list</a>:</td><td> </td><td valign="top"><a href="#Reporting-Problems">Reporting Problems</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make"><code>make</code></a>:</td><td> </td><td valign="top"><a href="#Make-utility">Make utility</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-malloc_005fhook-_0028_0029"><code>malloc_hook ()</code></a>:</td><td> </td><td valign="top"><a href="#Customizing-the-memory-allocator">Customizing the memory allocator</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mask_005ffield-_0028_0029"><code>mask_field ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-max-_0028_0029"><code>max ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-min-_0028_0029"><code>min ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-minus-_0028_0029"><code>minus ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-minus1-_0028_0029"><code>minus1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-minusp-_0028_0029"><code>minusp ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mod-_0028_0029"><code>mod ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-modifying-operators">modifying operators</a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-modular-integer">modular integer</a>:</td><td> </td><td valign="top"><a href="#Modular-integers">Modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-modulus"><code>modulus</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-monomial-_0028_0029"><code>monomial ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Montgomery-multiplication">Montgomery multiplication</a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-most_005fnegative_005ffloat-_0028_0029"><code>most_negative_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-most_005fpositive_005ffloat-_0028_0029"><code>most_positive_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-floating_002dpoint-numbers">Conversion to floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mul-_0028_0029"><code>mul ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-namespace">namespace</a>:</td><td> </td><td valign="top"><a href="#Introduction">Introduction</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-nextprobprime_0028_0029"><code>nextprobprime()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-numerator-_0028_0029"><code>numerator ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-rational-functions">Elementary rational functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-oddp-_0028_0029"><code>oddp ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-one-_0028_0029"><code>one ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-one-_0028_0029-1"><code>one ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-one-_0028_0029-2"><code>one ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0021_003d-_0028_0029"><code>operator != ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0021_003d-_0028_0029-1"><code>operator != ()</code></a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0021_003d-_0028_0029-2"><code>operator != ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0021_003d-_0028_0029-3"><code>operator != ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0026-_0028_0029"><code>operator & ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0026_003d-_0028_0029"><code>operator &= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_0028_0029-_0028_0029"><code>operator () ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002a-_0028_0029"><code>operator * ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002a-_0028_0029-1"><code>operator * ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002a-_0028_0029-2"><code>operator * ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002a_003d-_0028_0029"><code>operator *= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002b-_0028_0029"><code>operator + ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002b-_0028_0029-1"><code>operator + ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002b-_0028_0029-2"><code>operator + ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002b_002b-_0028_0029"><code>operator ++ ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002b_003d-_0028_0029"><code>operator += ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002d-_0028_0029"><code>operator - ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002d-_0028_0029-1"><code>operator - ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002d-_0028_0029-2"><code>operator - ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002d_002d-_0028_0029"><code>operator -- ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002d_003d-_0028_0029"><code>operator -= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002f-_0028_0029"><code>operator / ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_002f_003d-_0028_0029"><code>operator /= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c-_0028_0029"><code>operator < ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003c-_0028_0029"><code>operator << ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003c-_0028_0029-1"><code>operator << ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003c-_0028_0029-2"><code>operator << ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003c-_0028_0029-3"><code>operator << ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003c_003d-_0028_0029"><code>operator <<= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003c_003d-_0028_0029"><code>operator <= ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003d_003d-_0028_0029"><code>operator == ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003d_003d-_0028_0029-1"><code>operator == ()</code></a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003d_003d-_0028_0029-2"><code>operator == ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003d_003d-_0028_0029-3"><code>operator == ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003e-_0028_0029"><code>operator > ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003e_003d-_0028_0029"><code>operator >= ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003e_003e-_0028_0029"><code>operator >> ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003e_003e-_0028_0029-1"><code>operator >> ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_003e_003e_003d-_0028_0029"><code>operator >>= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_005b_005d-_0028_0029"><code>operator [] ()</code></a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_005e-_0028_0029"><code>operator ^ ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_005e_003d-_0028_0029"><code>operator ^= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_007c-_0028_0029"><code>operator | ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_007c_003d-_0028_0029"><code>operator |= ()</code></a>:</td><td> </td><td valign="top"><a href="#Modifying-operators">Modifying operators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-operator-_007e-_0028_0029"><code>operator ~ ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ord2-_0028_0029"><code>ord2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-phase-_0028_0029"><code>phase ()</code></a>:</td><td> </td><td valign="top"><a href="#Exponential-and-logarithmic-functions">Exponential and logarithmic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pi">pi</a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pi-_0028_0029"><code>pi ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pkg_002dconfig"><code>pkg-config</code></a>:</td><td> </td><td valign="top"><a href="#Compiler-options">Compiler options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-plus-_0028_0029"><code>plus ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-plus1-_0028_0029"><code>plus1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-plusp-_0028_0029"><code>plusp ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-polynomial">polynomial</a>:</td><td> </td><td valign="top"><a href="#Univariate-polynomials">Univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-portability">portability</a>:</td><td> </td><td valign="top"><a href="#Why-C_002b_002b-_003f">Why C++ ?</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-power2p-_0028_0029"><code>power2p ()</code></a>:</td><td> </td><td valign="top"><a href="#Logical-functions">Logical functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-prime">prime</a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-printing">printing</a>:</td><td> </td><td valign="top"><a href="#Internal-and-printed-representation">Internal and printed representation</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-random-_0028_0029"><code>random ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random32-_0028_0029"><code>random32 ()</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_005fF-_0028_0029"><code>random_F ()</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_005fI-_0028_0029"><code>random_I ()</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_005fR-_0028_0029"><code>random_R ()</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-random_005fstate"><code>random_state</code></a>:</td><td> </td><td valign="top"><a href="#Random-number-generators">Random number generators</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rational-_0028_0029"><code>rational ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-rational-numbers">Conversion to rational numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rational-number">rational number</a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rationalize-_0028_0029"><code>rationalize ()</code></a>:</td><td> </td><td valign="top"><a href="#Conversion-to-rational-numbers">Conversion to rational numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reading">reading</a>:</td><td> </td><td valign="top"><a href="#Internal-and-printed-representation">Internal and printed representation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-read_005fnumber_005fexception"><code>read_number_exception</code></a>:</td><td> </td><td valign="top"><a href="#Error-handling">Error handling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-real-number">real number</a>:</td><td> </td><td valign="top"><a href="#Ordinary-number-types">Ordinary number types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-realpart-_0028_0029"><code>realpart ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-complex-functions">Elementary complex functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-recip-_0028_0029"><code>recip ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-recip-_0028_0029-1"><code>recip ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reference-counting">reference counting</a>:</td><td> </td><td valign="top"><a href="#Memory-efficiency">Memory efficiency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rem-_0028_0029"><code>rem ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-representation">representation</a>:</td><td> </td><td valign="top"><a href="#Internal-and-printed-representation">Internal and printed representation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-retract-_0028_0029"><code>retract ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Riemann_0027s-zeta">Riemann’s zeta</a>:</td><td> </td><td valign="top"><a href="#Riemann-zeta">Riemann zeta</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ring">ring</a>:</td><td> </td><td valign="top"><a href="#Modular-integer-rings">Modular integer rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ring-_0028_0029"><code>ring ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ring-_0028_0029-1"><code>ring ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rootp-_0028_0029"><code>rootp ()</code></a>:</td><td> </td><td valign="top"><a href="#Roots">Roots</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-round1-_0028_0029"><code>round1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-round2-_0028_0029"><code>round2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rounding">rounding</a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rounding-error">rounding error</a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-numbers">Floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Rubik_0027s-cube">Rubik’s cube</a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-runtime_005fexception"><code>runtime_exception</code></a>:</td><td> </td><td valign="top"><a href="#Error-handling">Error handling</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-scale_005ffloat-_0028_0029"><code>scale_float ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-floating_002dpoint-numbers">Functions on floating-point numbers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sed"><code>sed</code></a>:</td><td> </td><td valign="top"><a href="#Sed-utility">Sed utility</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set_005fcoeff-_0028_0029"><code>set_coeff ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signum-_0028_0029"><code>signum ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sin-_0028_0029"><code>sin ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sinh-_0028_0029"><code>sinh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-size_0028_0029"><code>size()</code></a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sqrt-_0028_0029"><code>sqrt ()</code></a>:</td><td> </td><td valign="top"><a href="#Roots">Roots</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sqrt-_0028_0029-1"><code>sqrt ()</code></a>:</td><td> </td><td valign="top"><a href="#Roots">Roots</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sqrtp-_0028_0029"><code>sqrtp ()</code></a>:</td><td> </td><td valign="top"><a href="#Roots">Roots</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-square-_0028_0029"><code>square ()</code></a>:</td><td> </td><td valign="top"><a href="#Elementary-functions">Elementary functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-square-_0028_0029-1"><code>square ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-square-_0028_0029-2"><code>square ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-square-_0028_0029-3"><code>square ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string">string</a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-strlen-_0028_0029"><code>strlen ()</code></a>:</td><td> </td><td valign="top"><a href="#Strings">Strings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol">symbol</a>:</td><td> </td><td valign="top"><a href="#Symbols">Symbols</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbolic-type">symbolic type</a>:</td><td> </td><td valign="top"><a href="#Symbolic-data-types">Symbolic data types</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-tan-_0028_0029"><code>tan ()</code></a>:</td><td> </td><td valign="top"><a href="#Trigonometric-functions">Trigonometric functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tanh-_0028_0029"><code>tanh ()</code></a>:</td><td> </td><td valign="top"><a href="#Hyperbolic-functions">Hyperbolic functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-The_0028_0029_0028_0029"><code>The()()</code></a>:</td><td> </td><td valign="top"><a href="#Conversions">Conversions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-transcendental-functions">transcendental functions</a>:</td><td> </td><td valign="top"><a href="#Transcendental-functions">Transcendental functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-truncate1-_0028_0029"><code>truncate1 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-truncate2-_0028_0029"><code>truncate2 ()</code></a>:</td><td> </td><td valign="top"><a href="#Rounding-functions">Rounding functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-tschebychev-_0028_0029"><code>tschebychev ()</code></a>:</td><td> </td><td valign="top"><a href="#Special-polynomials">Special polynomials</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-uminus-_0028_0029"><code>uminus ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-underflow">underflow</a>:</td><td> </td><td valign="top"><a href="#Floating_002dpoint-underflow">Floating-point underflow</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-univariate-polynomial">univariate polynomial</a>:</td><td> </td><td valign="top"><a href="#Univariate-polynomials">Univariate polynomials</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-X">X</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-xgcd-_0028_0029"><code>xgcd ()</code></a>:</td><td> </td><td valign="top"><a href="#Number-theoretic-functions">Number theoretic functions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_my_letter-Z">Z</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-zero-_0028_0029"><code>zero ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zero-_0028_0029-1"><code>zero ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zero-_0028_0029-2"><code>zero ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zerop-_0028_0029"><code>zerop ()</code></a>:</td><td> </td><td valign="top"><a href="#Comparisons">Comparisons</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zerop-_0028_0029-1"><code>zerop ()</code></a>:</td><td> </td><td valign="top"><a href="#Rings">Rings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zerop-_0028_0029-2"><code>zerop ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-modular-integers">Functions on modular integers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zerop-_0028_0029-3"><code>zerop ()</code></a>:</td><td> </td><td valign="top"><a href="#Functions-on-univariate-polynomials">Functions on univariate polynomials</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-zeta-_0028_0029"><code>zeta ()</code></a>:</td><td> </td><td valign="top"><a href="#Riemann-zeta">Riemann zeta</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: </th><td><a class="summary-letter" href="#Index_my_letter-A"><b>A</b></a>
<a class="summary-letter" href="#Index_my_letter-B"><b>B</b></a>
<a class="summary-letter" href="#Index_my_letter-C"><b>C</b></a>
<a class="summary-letter" href="#Index_my_letter-D"><b>D</b></a>
<a class="summary-letter" href="#Index_my_letter-E"><b>E</b></a>
<a class="summary-letter" href="#Index_my_letter-F"><b>F</b></a>
<a class="summary-letter" href="#Index_my_letter-G"><b>G</b></a>
<a class="summary-letter" href="#Index_my_letter-H"><b>H</b></a>
<a class="summary-letter" href="#Index_my_letter-I"><b>I</b></a>
<a class="summary-letter" href="#Index_my_letter-J"><b>J</b></a>
<a class="summary-letter" href="#Index_my_letter-L"><b>L</b></a>
<a class="summary-letter" href="#Index_my_letter-M"><b>M</b></a>
<a class="summary-letter" href="#Index_my_letter-N"><b>N</b></a>
<a class="summary-letter" href="#Index_my_letter-O"><b>O</b></a>
<a class="summary-letter" href="#Index_my_letter-P"><b>P</b></a>
<a class="summary-letter" href="#Index_my_letter-R"><b>R</b></a>
<a class="summary-letter" href="#Index_my_letter-S"><b>S</b></a>
<a class="summary-letter" href="#Index_my_letter-T"><b>T</b></a>
<a class="summary-letter" href="#Index_my_letter-U"><b>U</b></a>
<a class="summary-letter" href="#Index_my_letter-X"><b>X</b></a>
<a class="summary-letter" href="#Index_my_letter-Z"><b>Z</b></a>
</td></tr></table>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p>If you installed CLN to
non-standard location <var>prefix</var>, you need to set the
<code>PKG_CONFIG_PATH</code> environment variable to <var>prefix</var>/lib/pkgconfig
for this to work.</p>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>See the <code>pkg-config</code> documentation for more details.</p>
</div>
<hr>
</body>
</html>
|