diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog | 7 | ||||
-rw-r--r-- | doc/awkcard.in | 6 | ||||
-rw-r--r-- | doc/gawk.1 | 2 | ||||
-rw-r--r-- | doc/gawk.info | 773 | ||||
-rw-r--r-- | doc/gawk.texi | 32 | ||||
-rw-r--r-- | doc/gawktexi.in | 32 |
6 files changed, 404 insertions, 448 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index db8cf4a5..43bba530 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -49,6 +49,13 @@ 2017-04-16 Arnold D. Robbins <arnold@skeeve.com> + * awkcard.in: Comment out description of intdiv(). + * gawk.1: Ditto. + * gawktexi.in: References to intdiv changed to intdiv0 and + bracketed inside @ifset INTDIV. Not set by default. + +2017-04-16 Arnold D. Robbins <arnold@skeeve.com> + * gawktexi.in: Improve documentation of the intdiv() function. 2017-04-12 Arnold D. Robbins <arnold@skeeve.com> diff --git a/doc/awkcard.in b/doc/awkcard.in index 86aeee2e..165fca43 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -1617,9 +1617,9 @@ l lw(1.9i). \*(FCcos(\*(FIexpr\*(FC)\*(FR The cosine of \*(FIexpr\fP, which is in radians. \*(FCexp(\*(FIexpr\*(FC)\*(FR The exponential function (\*(FIe \*(FC^ \*(FIx\*(FR). \*(FCint(\*(FIexpr\*(FC)\*(FR Truncate to integer. -\*(CB\*(FCintdiv(\*(FIn\*(FR\*(FC,\*(FI d\*(FR\*(FC,\*(FI r\*(FR\*(FC)\*(FR T{ -Return result of integer division in \*(FIr\*(FR.\*(CD -T} +.\" \*(CB\*(FCintdiv(\*(FIn\*(FR\*(FC,\*(FI d\*(FR\*(FC,\*(FI r\*(FR\*(FC)\*(FR T{ +.\" Return result of integer division in \*(FIr\*(FR.\*(CD +.\" T} \*(FClog(\*(FIexpr\*(FC)\*(FR The natural logarithm function (base \*(FIe\^\*(FR). \*(FCrand()\fP A random number \*(FIN\fP such that 0 \(<= \*(FIN\fP < 1. \*(FCsin(\*(FIexpr\*(FC)\*(FR The sine of \*(FIexpr\fP, which is in radians. @@ -2711,6 +2711,7 @@ The exponential function. .TP .BI int( expr ) Truncate to integer. +.ig .TP .BI intdiv( num ", " denom ", " result ) Truncate @@ -2728,6 +2729,7 @@ This is a .I gawk extension, primarily of value when working with arbitrarily large integers. +.. .TP .BI log( expr ) The natural logarithm function. diff --git a/doc/gawk.info b/doc/gawk.info index 66ba25c4..0ff0fdfd 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -12400,24 +12400,6 @@ brackets ([ ]): truncated toward zero. For example, 'int(3)' is 3, 'int(3.9)' is 3, 'int(-3.9)' is -3, and 'int(-3)' is -3 as well. -'intdiv(NUMERATOR, DENOMINATOR, RESULT)' - Perform integer division, similar to the standard C 'div()' - function. First, truncate 'numerator' and 'denominator' towards - zero, creating integer values. Clear the 'result' array, and then - set 'result["quotient"]' to the result of 'numerator / - denominator', truncated towards zero to an integer, and set - 'result["remainder"]' to the result of 'numerator % denominator', - truncated towards zero to an integer. Attempting division by zero - causes a fatal error. The function returns zero upon success, and - -1 upon error. - - This function is primarily intended for use with arbitrary length - integers; it avoids creating MPFR arbitrary precision - floating-point values (*note Arbitrary Precision Integers::). - - This function is a 'gawk' extension. It is not available in - compatibility mode (*note Options::). - 'log(X)' Return the natural logarithm of X, if X is positive; otherwise, return 'NaN' ("not a number") on IEEE 754 systems. Additionally, @@ -23215,59 +23197,7 @@ the following: When dividing two arbitrary precision integers with either '/' or '%', the result is typically an arbitrary precision floating point value -(unless the denominator evenly divides into the numerator). In order to -do integer division or remainder with arbitrary precision integers, use -the built-in 'intdiv()' function (*note Numeric Functions::). - - You can simulate the 'intdiv()' function in standard 'awk' using this -user-defined function: - - # intdiv --- do integer division - - function intdiv(numerator, denominator, result) - { - split("", result) - - numerator = int(numerator) - denominator = int(denominator) - result["quotient"] = int(numerator / denominator) - result["remainder"] = int(numerator % denominator) - - return 0.0 - } - - The following example program, contributed by Katie Wasserman, uses -'intdiv()' to compute the digits of pi to as many places as you choose -to set: - - # pi.awk --- compute the digits of pi - - BEGIN { - digits = 100000 - two = 2 * 10 ^ digits - pi = two - for (m = digits * 4; m > 0; --m) { - d = m * 2 + 1 - x = pi * m - intdiv(x, d, result) - pi = result["quotient"] - pi = pi + two - } - print pi - } - - When asked about the algorithm used, Katie replied: - - It's not that well known but it's not that obscure either. It's - Euler's modification to Newton's method for calculating pi. Take a - look at lines (23) - (25) here: - <http://mathworld.wolfram.com/PiFormulas.html>. - - The algorithm I wrote simply expands the multiply by 2 and works - from the innermost expression outwards. I used this to program HP - calculators because it's quite easy to modify for tiny memory - devices with smallish word sizes. See - <http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899>. +(unless the denominator evenly divides into the numerator). ---------- Footnotes ---------- @@ -27586,9 +27516,6 @@ current version of 'gawk'. - The 'bindtextdomain()', 'dcgettext()', and 'dcngettext()' functions for internationalization (*note Programmer i18n::) - - The 'intdiv()' function for doing integer division and - remainder (*note Numeric Functions::) - * Changes and/or additions in the command-line options: - The 'AWKPATH' environment variable for specifying a path @@ -28053,8 +27980,6 @@ POSIX 'awk', in the order they were added to 'gawk'. * The 'igawk' program and its manual page are no longer installed when 'gawk' is built. *Note Igawk Program::. - * The 'intdiv()' function. *Note Numeric Functions::. - * The maximum number of hexadecimal digits in '\x' escapes is now two. *Note Escape Sequences::. @@ -34466,8 +34391,6 @@ Index * instruction tracing, in debugger: Debugger Info. (line 90) * int: Numeric Functions. (line 24) * INT signal (MS-Windows): Profiling. (line 212) -* intdiv: Numeric Functions. (line 29) -* intdiv <1>: Numeric Functions. (line 29) * integer array indices: Numeric Array Subscripts. (line 31) * integers, arbitrary precision: Arbitrary Precision Integers. @@ -34617,9 +34540,9 @@ Index * localization: I18N and L10N. (line 6) * localization, See internationalization, localization: I18N and L10N. (line 6) -* log: Numeric Functions. (line 47) +* log: Numeric Functions. (line 29) * log files, timestamps in: Time Functions. (line 6) -* logarithm: Numeric Functions. (line 47) +* logarithm: Numeric Functions. (line 29) * logical false/true: Truth Values. (line 6) * logical operators, See Boolean expressions: Boolean Ops. (line 6) * login information: Passwd Functions. (line 16) @@ -35083,12 +35006,12 @@ Index * Rakitzis, Byron: History Sorting. (line 25) * Ramey, Chet: Acknowledgments. (line 60) * Ramey, Chet <1>: General Data Types. (line 6) -* rand: Numeric Functions. (line 52) +* rand: Numeric Functions. (line 34) * random numbers, Cliff: Cliff Random Function. (line 6) * random numbers, rand()/srand() functions: Numeric Functions. - (line 52) -* random numbers, seed of: Numeric Functions. (line 82) + (line 34) +* random numbers, seed of: Numeric Functions. (line 64) * range expressions (regexps): Bracket Expressions. (line 6) * range patterns: Ranges. (line 6) * range patterns, line continuation and: Ranges. (line 64) @@ -35266,7 +35189,7 @@ Index * sed utility: Full Line Fields. (line 22) * sed utility <1>: Simple Sed. (line 6) * sed utility <2>: Glossary. (line 16) -* seeding random number generator: Numeric Functions. (line 82) +* seeding random number generator: Numeric Functions. (line 64) * semicolon (;), AWKPATH variable and: PC Using. (line 9) * semicolon (;), separating statements in actions: Statements/Lines. (line 90) @@ -35370,8 +35293,8 @@ Index * SIGUSR1 signal, for dynamic profiling: Profiling. (line 186) * silent debugger command: Debugger Execution Control. (line 10) -* sin: Numeric Functions. (line 93) -* sine: Numeric Functions. (line 93) +* sin: Numeric Functions. (line 75) +* sine: Numeric Functions. (line 75) * single quote ('): One-shot. (line 15) * single quote (') in gawk command lines: Long. (line 35) * single quote ('), in shell commands: Quoting. (line 48) @@ -35421,10 +35344,10 @@ Index * sprintf() function, OFMT variable and: User-modified. (line 116) * sprintf() function, print/printf statements and: Round Function. (line 6) -* sqrt: Numeric Functions. (line 96) +* sqrt: Numeric Functions. (line 78) * square brackets ([]), regexp operator: Regexp Operators. (line 56) -* square root: Numeric Functions. (line 96) -* srand: Numeric Functions. (line 100) +* square root: Numeric Functions. (line 78) +* srand: Numeric Functions. (line 82) * stack frame: Debugging Terms. (line 10) * Stallman, Richard: Manual History. (line 6) * Stallman, Richard <1>: Acknowledgments. (line 18) @@ -35989,341 +35912,341 @@ Node: Functions521911 Node: Built-in522949 Node: Calling Built-in524030 Node: Numeric Functions526026 -Ref: Numeric Functions-Footnote-1530971 -Ref: Numeric Functions-Footnote-2531328 -Ref: Numeric Functions-Footnote-3531376 -Node: String Functions531648 -Ref: String Functions-Footnote-1555306 -Ref: String Functions-Footnote-2555434 -Ref: String Functions-Footnote-3555682 -Node: Gory Details555769 -Ref: table-sub-escapes557560 -Ref: table-sub-proposed559079 -Ref: table-posix-sub560442 -Ref: table-gensub-escapes561983 -Ref: Gory Details-Footnote-1562806 -Node: I/O Functions562960 -Ref: table-system-return-values569542 -Ref: I/O Functions-Footnote-1571522 -Ref: I/O Functions-Footnote-2571670 -Node: Time Functions571790 -Ref: Time Functions-Footnote-1582457 -Ref: Time Functions-Footnote-2582525 -Ref: Time Functions-Footnote-3582683 -Ref: Time Functions-Footnote-4582794 -Ref: Time Functions-Footnote-5582906 -Ref: Time Functions-Footnote-6583133 -Node: Bitwise Functions583399 -Ref: table-bitwise-ops583993 -Ref: Bitwise Functions-Footnote-1590026 -Ref: Bitwise Functions-Footnote-2590199 -Node: Type Functions590390 -Node: I18N Functions593065 -Node: User-defined594716 -Node: Definition Syntax595521 -Ref: Definition Syntax-Footnote-1601208 -Node: Function Example601279 -Ref: Function Example-Footnote-1604201 -Node: Function Caveats604223 -Node: Calling A Function604741 -Node: Variable Scope605699 -Node: Pass By Value/Reference608693 -Node: Return Statement612192 -Node: Dynamic Typing615171 -Node: Indirect Calls616101 -Ref: Indirect Calls-Footnote-1626352 -Node: Functions Summary626480 -Node: Library Functions629185 -Ref: Library Functions-Footnote-1632792 -Ref: Library Functions-Footnote-2632935 -Node: Library Names633106 -Ref: Library Names-Footnote-1636566 -Ref: Library Names-Footnote-2636789 -Node: General Functions636875 -Node: Strtonum Function637978 -Node: Assert Function641000 -Node: Round Function644326 -Node: Cliff Random Function645867 -Node: Ordinal Functions646883 -Ref: Ordinal Functions-Footnote-1649946 -Ref: Ordinal Functions-Footnote-2650198 -Node: Join Function650408 -Ref: Join Function-Footnote-1652178 -Node: Getlocaltime Function652378 -Node: Readfile Function656120 -Node: Shell Quoting658092 -Node: Data File Management659493 -Node: Filetrans Function660125 -Node: Rewind Function664221 -Node: File Checking666131 -Ref: File Checking-Footnote-1667465 -Node: Empty Files667666 -Node: Ignoring Assigns669645 -Node: Getopt Function671195 -Ref: Getopt Function-Footnote-1682664 -Node: Passwd Functions682864 -Ref: Passwd Functions-Footnote-1691703 -Node: Group Functions691791 -Ref: Group Functions-Footnote-1699689 -Node: Walking Arrays699896 -Node: Library Functions Summary702904 -Node: Library Exercises704310 -Node: Sample Programs704775 -Node: Running Examples705545 -Node: Clones706273 -Node: Cut Program707497 -Node: Egrep Program717426 -Ref: Egrep Program-Footnote-1724938 -Node: Id Program725048 -Node: Split Program728728 -Ref: Split Program-Footnote-1732187 -Node: Tee Program732316 -Node: Uniq Program735106 -Node: Wc Program742532 -Ref: Wc Program-Footnote-1746787 -Node: Miscellaneous Programs746881 -Node: Dupword Program748094 -Node: Alarm Program750124 -Node: Translate Program754979 -Ref: Translate Program-Footnote-1759544 -Node: Labels Program759814 -Ref: Labels Program-Footnote-1763165 -Node: Word Sorting763249 -Node: History Sorting767321 -Node: Extract Program769156 -Node: Simple Sed776685 -Node: Igawk Program779759 -Ref: Igawk Program-Footnote-1794090 -Ref: Igawk Program-Footnote-2794292 -Ref: Igawk Program-Footnote-3794414 -Node: Anagram Program794529 -Node: Signature Program797591 -Node: Programs Summary798838 -Node: Programs Exercises800052 -Ref: Programs Exercises-Footnote-1804181 -Node: Advanced Features804272 -Node: Nondecimal Data806262 -Node: Array Sorting807853 -Node: Controlling Array Traversal808553 -Ref: Controlling Array Traversal-Footnote-1816920 -Node: Array Sorting Functions817038 -Ref: Array Sorting Functions-Footnote-1822129 -Node: Two-way I/O822325 -Ref: Two-way I/O-Footnote-1828876 -Ref: Two-way I/O-Footnote-2829063 -Node: TCP/IP Networking829145 -Node: Profiling832263 -Ref: Profiling-Footnote-1840935 -Node: Advanced Features Summary841258 -Node: Internationalization843102 -Node: I18N and L10N844582 -Node: Explaining gettext845269 -Ref: Explaining gettext-Footnote-1851161 -Ref: Explaining gettext-Footnote-2851346 -Node: Programmer i18n851511 -Ref: Programmer i18n-Footnote-1856460 -Node: Translator i18n856509 -Node: String Extraction857303 -Ref: String Extraction-Footnote-1858435 -Node: Printf Ordering858521 -Ref: Printf Ordering-Footnote-1861307 -Node: I18N Portability861371 -Ref: I18N Portability-Footnote-1863827 -Node: I18N Example863890 -Ref: I18N Example-Footnote-1866696 -Node: Gawk I18N866769 -Node: I18N Summary867414 -Node: Debugger868755 -Node: Debugging869777 -Node: Debugging Concepts870218 -Node: Debugging Terms872027 -Node: Awk Debugging874602 -Node: Sample Debugging Session875508 -Node: Debugger Invocation876042 -Node: Finding The Bug877428 -Node: List of Debugger Commands883906 -Node: Breakpoint Control885239 -Node: Debugger Execution Control888933 -Node: Viewing And Changing Data892295 -Node: Execution Stack895669 -Node: Debugger Info897306 -Node: Miscellaneous Debugger Commands901377 -Node: Readline Support906465 -Node: Limitations907361 -Node: Debugging Summary909470 -Node: Arbitrary Precision Arithmetic910749 -Node: Computer Arithmetic912234 -Ref: table-numeric-ranges915825 -Ref: Computer Arithmetic-Footnote-1916547 -Node: Math Definitions916604 -Ref: table-ieee-formats919918 -Ref: Math Definitions-Footnote-1920521 -Node: MPFR features920626 -Node: FP Math Caution922343 -Ref: FP Math Caution-Footnote-1923415 -Node: Inexactness of computations923784 -Node: Inexact representation924744 -Node: Comparing FP Values926104 -Node: Errors accumulate927186 -Node: Getting Accuracy928619 -Node: Try To Round931329 -Node: Setting precision932228 -Ref: table-predefined-precision-strings932925 -Node: Setting the rounding mode934755 -Ref: table-gawk-rounding-modes935129 -Ref: Setting the rounding mode-Footnote-1938537 -Node: Arbitrary Precision Integers938716 -Ref: Arbitrary Precision Integers-Footnote-1943621 -Node: Checking for MPFR943770 -Node: POSIX Floating Point Problems945067 -Ref: POSIX Floating Point Problems-Footnote-1948938 -Node: Floating point summary948976 -Node: Dynamic Extensions951166 -Node: Extension Intro952719 -Node: Plugin License953985 -Node: Extension Mechanism Outline954782 -Ref: figure-load-extension955221 -Ref: figure-register-new-function956786 -Ref: figure-call-new-function957878 -Node: Extension API Description959940 -Node: Extension API Functions Introduction961582 -Node: General Data Types966916 -Ref: General Data Types-Footnote-1974121 -Node: Memory Allocation Functions974420 -Ref: Memory Allocation Functions-Footnote-1977572 -Node: Constructor Functions977671 -Node: Registration Functions980670 -Node: Extension Functions981355 -Node: Exit Callback Functions986568 -Node: Extension Version String987818 -Node: Input Parsers988481 -Node: Output Wrappers1001188 -Node: Two-way processors1005700 -Node: Printing Messages1007965 -Ref: Printing Messages-Footnote-11009136 -Node: Updating ERRNO1009289 -Node: Requesting Values1010028 -Ref: table-value-types-returned1010765 -Node: Accessing Parameters1011701 -Node: Symbol Table Access1012936 -Node: Symbol table by name1013448 -Node: Symbol table by cookie1015237 -Ref: Symbol table by cookie-Footnote-11019422 -Node: Cached values1019486 -Ref: Cached values-Footnote-11023022 -Node: Array Manipulation1023113 -Ref: Array Manipulation-Footnote-11024204 -Node: Array Data Types1024241 -Ref: Array Data Types-Footnote-11026899 -Node: Array Functions1026991 -Node: Flattening Arrays1031390 -Node: Creating Arrays1038331 -Node: Redirection API1043100 -Node: Extension API Variables1045942 -Node: Extension Versioning1046575 -Ref: gawk-api-version1047012 -Node: Extension API Informational Variables1048740 -Node: Extension API Boilerplate1049804 -Node: Changes from API V11053666 -Node: Finding Extensions1054326 -Node: Extension Example1054885 -Node: Internal File Description1055683 -Node: Internal File Ops1059763 -Ref: Internal File Ops-Footnote-11071163 -Node: Using Internal File Ops1071303 -Ref: Using Internal File Ops-Footnote-11073686 -Node: Extension Samples1073960 -Node: Extension Sample File Functions1075489 -Node: Extension Sample Fnmatch1083138 -Node: Extension Sample Fork1084625 -Node: Extension Sample Inplace1085843 -Node: Extension Sample Ord1089060 -Node: Extension Sample Readdir1089896 -Ref: table-readdir-file-types1090785 -Node: Extension Sample Revout1091590 -Node: Extension Sample Rev2way1092179 -Node: Extension Sample Read write array1092919 -Node: Extension Sample Readfile1094861 -Node: Extension Sample Time1095956 -Node: Extension Sample API Tests1097304 -Node: gawkextlib1097796 -Node: Extension summary1100243 -Node: Extension Exercises1103945 -Node: Language History1105443 -Node: V7/SVR3.11107099 -Node: SVR41109251 -Node: POSIX1110685 -Node: BTL1112064 -Node: POSIX/GNU1112793 -Node: Feature History1118685 -Node: Common Extensions1133109 -Node: Ranges and Locales1134392 -Ref: Ranges and Locales-Footnote-11139008 -Ref: Ranges and Locales-Footnote-21139035 -Ref: Ranges and Locales-Footnote-31139270 -Node: Contributors1139491 -Node: History summary1145051 -Node: Installation1146431 -Node: Gawk Distribution1147375 -Node: Getting1147859 -Node: Extracting1148820 -Node: Distribution contents1150458 -Node: Unix Installation1156800 -Node: Quick Installation1157482 -Node: Shell Startup Files1159896 -Node: Additional Configuration Options1160985 -Node: Configuration Philosophy1162974 -Node: Non-Unix Installation1165343 -Node: PC Installation1165803 -Node: PC Binary Installation1166641 -Node: PC Compiling1167076 -Node: PC Using1168193 -Node: Cygwin1171238 -Node: MSYS1172008 -Node: VMS Installation1172509 -Node: VMS Compilation1173300 -Ref: VMS Compilation-Footnote-11174529 -Node: VMS Dynamic Extensions1174587 -Node: VMS Installation Details1176272 -Node: VMS Running1178525 -Node: VMS GNV1182804 -Node: VMS Old Gawk1183539 -Node: Bugs1184010 -Node: Bug address1184673 -Node: Usenet1187070 -Node: Maintainers1187847 -Node: Other Versions1189223 -Node: Installation summary1195807 -Node: Notes1196842 -Node: Compatibility Mode1197707 -Node: Additions1198489 -Node: Accessing The Source1199414 -Node: Adding Code1200849 -Node: New Ports1207067 -Node: Derived Files1211555 -Ref: Derived Files-Footnote-11217040 -Ref: Derived Files-Footnote-21217075 -Ref: Derived Files-Footnote-31217673 -Node: Future Extensions1217787 -Node: Implementation Limitations1218445 -Node: Extension Design1219628 -Node: Old Extension Problems1220782 -Ref: Old Extension Problems-Footnote-11222300 -Node: Extension New Mechanism Goals1222357 -Ref: Extension New Mechanism Goals-Footnote-11225721 -Node: Extension Other Design Decisions1225910 -Node: Extension Future Growth1228023 -Node: Old Extension Mechanism1228859 -Node: Notes summary1230622 -Node: Basic Concepts1231804 -Node: Basic High Level1232485 -Ref: figure-general-flow1232767 -Ref: figure-process-flow1233452 -Ref: Basic High Level-Footnote-11236753 -Node: Basic Data Typing1236938 -Node: Glossary1240266 -Node: Copying1272213 -Node: GNU Free Documentation License1309752 -Node: Index1334870 +Ref: Numeric Functions-Footnote-1530054 +Ref: Numeric Functions-Footnote-2530411 +Ref: Numeric Functions-Footnote-3530459 +Node: String Functions530731 +Ref: String Functions-Footnote-1554389 +Ref: String Functions-Footnote-2554517 +Ref: String Functions-Footnote-3554765 +Node: Gory Details554852 +Ref: table-sub-escapes556643 +Ref: table-sub-proposed558162 +Ref: table-posix-sub559525 +Ref: table-gensub-escapes561066 +Ref: Gory Details-Footnote-1561889 +Node: I/O Functions562043 +Ref: table-system-return-values568625 +Ref: I/O Functions-Footnote-1570605 +Ref: I/O Functions-Footnote-2570753 +Node: Time Functions570873 +Ref: Time Functions-Footnote-1581540 +Ref: Time Functions-Footnote-2581608 +Ref: Time Functions-Footnote-3581766 +Ref: Time Functions-Footnote-4581877 +Ref: Time Functions-Footnote-5581989 +Ref: Time Functions-Footnote-6582216 +Node: Bitwise Functions582482 +Ref: table-bitwise-ops583076 +Ref: Bitwise Functions-Footnote-1589109 +Ref: Bitwise Functions-Footnote-2589282 +Node: Type Functions589473 +Node: I18N Functions592148 +Node: User-defined593799 +Node: Definition Syntax594604 +Ref: Definition Syntax-Footnote-1600291 +Node: Function Example600362 +Ref: Function Example-Footnote-1603284 +Node: Function Caveats603306 +Node: Calling A Function603824 +Node: Variable Scope604782 +Node: Pass By Value/Reference607776 +Node: Return Statement611275 +Node: Dynamic Typing614254 +Node: Indirect Calls615184 +Ref: Indirect Calls-Footnote-1625435 +Node: Functions Summary625563 +Node: Library Functions628268 +Ref: Library Functions-Footnote-1631875 +Ref: Library Functions-Footnote-2632018 +Node: Library Names632189 +Ref: Library Names-Footnote-1635649 +Ref: Library Names-Footnote-2635872 +Node: General Functions635958 +Node: Strtonum Function637061 +Node: Assert Function640083 +Node: Round Function643409 +Node: Cliff Random Function644950 +Node: Ordinal Functions645966 +Ref: Ordinal Functions-Footnote-1649029 +Ref: Ordinal Functions-Footnote-2649281 +Node: Join Function649491 +Ref: Join Function-Footnote-1651261 +Node: Getlocaltime Function651461 +Node: Readfile Function655203 +Node: Shell Quoting657175 +Node: Data File Management658576 +Node: Filetrans Function659208 +Node: Rewind Function663304 +Node: File Checking665214 +Ref: File Checking-Footnote-1666548 +Node: Empty Files666749 +Node: Ignoring Assigns668728 +Node: Getopt Function670278 +Ref: Getopt Function-Footnote-1681747 +Node: Passwd Functions681947 +Ref: Passwd Functions-Footnote-1690786 +Node: Group Functions690874 +Ref: Group Functions-Footnote-1698772 +Node: Walking Arrays698979 +Node: Library Functions Summary701987 +Node: Library Exercises703393 +Node: Sample Programs703858 +Node: Running Examples704628 +Node: Clones705356 +Node: Cut Program706580 +Node: Egrep Program716509 +Ref: Egrep Program-Footnote-1724021 +Node: Id Program724131 +Node: Split Program727811 +Ref: Split Program-Footnote-1731270 +Node: Tee Program731399 +Node: Uniq Program734189 +Node: Wc Program741615 +Ref: Wc Program-Footnote-1745870 +Node: Miscellaneous Programs745964 +Node: Dupword Program747177 +Node: Alarm Program749207 +Node: Translate Program754062 +Ref: Translate Program-Footnote-1758627 +Node: Labels Program758897 +Ref: Labels Program-Footnote-1762248 +Node: Word Sorting762332 +Node: History Sorting766404 +Node: Extract Program768239 +Node: Simple Sed775768 +Node: Igawk Program778842 +Ref: Igawk Program-Footnote-1793173 +Ref: Igawk Program-Footnote-2793375 +Ref: Igawk Program-Footnote-3793497 +Node: Anagram Program793612 +Node: Signature Program796674 +Node: Programs Summary797921 +Node: Programs Exercises799135 +Ref: Programs Exercises-Footnote-1803264 +Node: Advanced Features803355 +Node: Nondecimal Data805345 +Node: Array Sorting806936 +Node: Controlling Array Traversal807636 +Ref: Controlling Array Traversal-Footnote-1816003 +Node: Array Sorting Functions816121 +Ref: Array Sorting Functions-Footnote-1821212 +Node: Two-way I/O821408 +Ref: Two-way I/O-Footnote-1827959 +Ref: Two-way I/O-Footnote-2828146 +Node: TCP/IP Networking828228 +Node: Profiling831346 +Ref: Profiling-Footnote-1840018 +Node: Advanced Features Summary840341 +Node: Internationalization842185 +Node: I18N and L10N843665 +Node: Explaining gettext844352 +Ref: Explaining gettext-Footnote-1850244 +Ref: Explaining gettext-Footnote-2850429 +Node: Programmer i18n850594 +Ref: Programmer i18n-Footnote-1855543 +Node: Translator i18n855592 +Node: String Extraction856386 +Ref: String Extraction-Footnote-1857518 +Node: Printf Ordering857604 +Ref: Printf Ordering-Footnote-1860390 +Node: I18N Portability860454 +Ref: I18N Portability-Footnote-1862910 +Node: I18N Example862973 +Ref: I18N Example-Footnote-1865779 +Node: Gawk I18N865852 +Node: I18N Summary866497 +Node: Debugger867838 +Node: Debugging868860 +Node: Debugging Concepts869301 +Node: Debugging Terms871110 +Node: Awk Debugging873685 +Node: Sample Debugging Session874591 +Node: Debugger Invocation875125 +Node: Finding The Bug876511 +Node: List of Debugger Commands882989 +Node: Breakpoint Control884322 +Node: Debugger Execution Control888016 +Node: Viewing And Changing Data891378 +Node: Execution Stack894752 +Node: Debugger Info896389 +Node: Miscellaneous Debugger Commands900460 +Node: Readline Support905548 +Node: Limitations906444 +Node: Debugging Summary908553 +Node: Arbitrary Precision Arithmetic909832 +Node: Computer Arithmetic911317 +Ref: table-numeric-ranges914908 +Ref: Computer Arithmetic-Footnote-1915630 +Node: Math Definitions915687 +Ref: table-ieee-formats919001 +Ref: Math Definitions-Footnote-1919604 +Node: MPFR features919709 +Node: FP Math Caution921426 +Ref: FP Math Caution-Footnote-1922498 +Node: Inexactness of computations922867 +Node: Inexact representation923827 +Node: Comparing FP Values925187 +Node: Errors accumulate926269 +Node: Getting Accuracy927702 +Node: Try To Round930412 +Node: Setting precision931311 +Ref: table-predefined-precision-strings932008 +Node: Setting the rounding mode933838 +Ref: table-gawk-rounding-modes934212 +Ref: Setting the rounding mode-Footnote-1937620 +Node: Arbitrary Precision Integers937799 +Ref: Arbitrary Precision Integers-Footnote-1940974 +Node: Checking for MPFR941123 +Node: POSIX Floating Point Problems942420 +Ref: POSIX Floating Point Problems-Footnote-1946291 +Node: Floating point summary946329 +Node: Dynamic Extensions948519 +Node: Extension Intro950072 +Node: Plugin License951338 +Node: Extension Mechanism Outline952135 +Ref: figure-load-extension952574 +Ref: figure-register-new-function954139 +Ref: figure-call-new-function955231 +Node: Extension API Description957293 +Node: Extension API Functions Introduction958935 +Node: General Data Types964269 +Ref: General Data Types-Footnote-1971474 +Node: Memory Allocation Functions971773 +Ref: Memory Allocation Functions-Footnote-1974925 +Node: Constructor Functions975024 +Node: Registration Functions978023 +Node: Extension Functions978708 +Node: Exit Callback Functions983921 +Node: Extension Version String985171 +Node: Input Parsers985834 +Node: Output Wrappers998541 +Node: Two-way processors1003053 +Node: Printing Messages1005318 +Ref: Printing Messages-Footnote-11006489 +Node: Updating ERRNO1006642 +Node: Requesting Values1007381 +Ref: table-value-types-returned1008118 +Node: Accessing Parameters1009054 +Node: Symbol Table Access1010289 +Node: Symbol table by name1010801 +Node: Symbol table by cookie1012590 +Ref: Symbol table by cookie-Footnote-11016775 +Node: Cached values1016839 +Ref: Cached values-Footnote-11020375 +Node: Array Manipulation1020466 +Ref: Array Manipulation-Footnote-11021557 +Node: Array Data Types1021594 +Ref: Array Data Types-Footnote-11024252 +Node: Array Functions1024344 +Node: Flattening Arrays1028743 +Node: Creating Arrays1035684 +Node: Redirection API1040453 +Node: Extension API Variables1043295 +Node: Extension Versioning1043928 +Ref: gawk-api-version1044365 +Node: Extension API Informational Variables1046093 +Node: Extension API Boilerplate1047157 +Node: Changes from API V11051019 +Node: Finding Extensions1051679 +Node: Extension Example1052238 +Node: Internal File Description1053036 +Node: Internal File Ops1057116 +Ref: Internal File Ops-Footnote-11068516 +Node: Using Internal File Ops1068656 +Ref: Using Internal File Ops-Footnote-11071039 +Node: Extension Samples1071313 +Node: Extension Sample File Functions1072842 +Node: Extension Sample Fnmatch1080491 +Node: Extension Sample Fork1081978 +Node: Extension Sample Inplace1083196 +Node: Extension Sample Ord1086413 +Node: Extension Sample Readdir1087249 +Ref: table-readdir-file-types1088138 +Node: Extension Sample Revout1088943 +Node: Extension Sample Rev2way1089532 +Node: Extension Sample Read write array1090272 +Node: Extension Sample Readfile1092214 +Node: Extension Sample Time1093309 +Node: Extension Sample API Tests1094657 +Node: gawkextlib1095149 +Node: Extension summary1097596 +Node: Extension Exercises1101298 +Node: Language History1102796 +Node: V7/SVR3.11104452 +Node: SVR41106604 +Node: POSIX1108038 +Node: BTL1109417 +Node: POSIX/GNU1110146 +Node: Feature History1115924 +Node: Common Extensions1130289 +Node: Ranges and Locales1131572 +Ref: Ranges and Locales-Footnote-11136188 +Ref: Ranges and Locales-Footnote-21136215 +Ref: Ranges and Locales-Footnote-31136450 +Node: Contributors1136671 +Node: History summary1142231 +Node: Installation1143611 +Node: Gawk Distribution1144555 +Node: Getting1145039 +Node: Extracting1146000 +Node: Distribution contents1147638 +Node: Unix Installation1153980 +Node: Quick Installation1154662 +Node: Shell Startup Files1157076 +Node: Additional Configuration Options1158165 +Node: Configuration Philosophy1160154 +Node: Non-Unix Installation1162523 +Node: PC Installation1162983 +Node: PC Binary Installation1163821 +Node: PC Compiling1164256 +Node: PC Using1165373 +Node: Cygwin1168418 +Node: MSYS1169188 +Node: VMS Installation1169689 +Node: VMS Compilation1170480 +Ref: VMS Compilation-Footnote-11171709 +Node: VMS Dynamic Extensions1171767 +Node: VMS Installation Details1173452 +Node: VMS Running1175705 +Node: VMS GNV1179984 +Node: VMS Old Gawk1180719 +Node: Bugs1181190 +Node: Bug address1181853 +Node: Usenet1184250 +Node: Maintainers1185027 +Node: Other Versions1186403 +Node: Installation summary1192987 +Node: Notes1194022 +Node: Compatibility Mode1194887 +Node: Additions1195669 +Node: Accessing The Source1196594 +Node: Adding Code1198029 +Node: New Ports1204247 +Node: Derived Files1208735 +Ref: Derived Files-Footnote-11214220 +Ref: Derived Files-Footnote-21214255 +Ref: Derived Files-Footnote-31214853 +Node: Future Extensions1214967 +Node: Implementation Limitations1215625 +Node: Extension Design1216808 +Node: Old Extension Problems1217962 +Ref: Old Extension Problems-Footnote-11219480 +Node: Extension New Mechanism Goals1219537 +Ref: Extension New Mechanism Goals-Footnote-11222901 +Node: Extension Other Design Decisions1223090 +Node: Extension Future Growth1225203 +Node: Old Extension Mechanism1226039 +Node: Notes summary1227802 +Node: Basic Concepts1228984 +Node: Basic High Level1229665 +Ref: figure-general-flow1229947 +Ref: figure-process-flow1230632 +Ref: Basic High Level-Footnote-11233933 +Node: Basic Data Typing1234118 +Node: Glossary1237446 +Node: Copying1269393 +Node: GNU Free Documentation License1306932 +Node: Index1332050 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 76fb47d9..585fbf41 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -17566,9 +17566,10 @@ truncated toward zero. For example, @code{int(3)} is 3, @code{int(3.9)} is 3, @code{int(-3.9)} is @minus{}3, and @code{int(-3)} is @minus{}3 as well. -@item @code{intdiv(@var{numerator}, @var{denominator}, @var{result})} -@cindexawkfunc{intdiv} -@cindex intdiv +@ifset INTDIV +@item @code{intdiv0(@var{numerator}, @var{denominator}, @var{result})} +@cindexawkfunc{intdiv0} +@cindex intdiv0 Perform integer division, similar to the standard C @code{div()} function. First, truncate @code{numerator} and @code{denominator} towards zero, creating integer values. Clear the @code{result} @@ -17586,6 +17587,7 @@ Precision Integers}). This function is a @code{gawk} extension. It is not available in compatibility mode (@pxref{Options}). +@end ifset @item @code{log(@var{x})} @cindexawkfunc{log} @@ -32016,16 +32018,18 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}' When dividing two arbitrary precision integers with either @samp{/} or @samp{%}, the result is typically an arbitrary precision floating point value (unless the denominator evenly -divides into the numerator). In order to do integer division +divides into the numerator). +@ifset INTDIV +In order to do integer division or remainder with arbitrary precision integers, use the built-in -@code{intdiv()} function (@pxref{Numeric Functions}). +@code{intdiv0()} function (@pxref{Numeric Functions}). -You can simulate the @code{intdiv()} function in standard @command{awk} +You can simulate the @code{intdiv0()} function in standard @command{awk} using this user-defined function: @example @c file eg/lib/intdiv.awk -# intdiv --- do integer division +# intdiv0 --- do integer division @c endfile @ignore @@ -32036,12 +32040,15 @@ using this user-defined function: # # Name changed from div() to intdiv() # April, 2015 +# +# Changed to intdiv0() +# April, 2016 @c endfile @end ignore @c file eg/lib/intdiv.awk -function intdiv(numerator, denominator, result) +function intdiv0(numerator, denominator, result) @{ split("", result) @@ -32128,6 +32135,7 @@ because it's quite easy to modify for tiny memory devices with smallish word sizes. See @uref{http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899}. @end quotation +@end ifset @node Checking for MPFR @section How To Check If MPFR Is Available @@ -37234,10 +37242,12 @@ The @code{bindtextdomain()}, @code{dcgettext()}, and @code{dcngettext()} functions for internationalization (@pxref{Programmer i18n}) +@ifset INTDIV @item -The @code{intdiv()} function for doing integer +The @code{intdiv0()} function for doing integer division and remainder (@pxref{Numeric Functions}) +@end ifset @end itemize @item @@ -38033,9 +38043,11 @@ The @command{igawk} program and its manual page are no longer installed when @command{gawk} is built. @xref{Igawk Program}. +@ifset INTDIV @item -The @code{intdiv()} function. +The @code{intdiv0()} function. @xref{Numeric Functions}. +@end ifset @item The maximum number of hexadecimal digits in @samp{\x} escapes diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 357ebe34..d19081ad 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -16839,9 +16839,10 @@ truncated toward zero. For example, @code{int(3)} is 3, @code{int(3.9)} is 3, @code{int(-3.9)} is @minus{}3, and @code{int(-3)} is @minus{}3 as well. -@item @code{intdiv(@var{numerator}, @var{denominator}, @var{result})} -@cindexawkfunc{intdiv} -@cindex intdiv +@ifset INTDIV +@item @code{intdiv0(@var{numerator}, @var{denominator}, @var{result})} +@cindexawkfunc{intdiv0} +@cindex intdiv0 Perform integer division, similar to the standard C @code{div()} function. First, truncate @code{numerator} and @code{denominator} towards zero, creating integer values. Clear the @code{result} @@ -16859,6 +16860,7 @@ Precision Integers}). This function is a @code{gawk} extension. It is not available in compatibility mode (@pxref{Options}). +@end ifset @item @code{log(@var{x})} @cindexawkfunc{log} @@ -31030,16 +31032,18 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}' When dividing two arbitrary precision integers with either @samp{/} or @samp{%}, the result is typically an arbitrary precision floating point value (unless the denominator evenly -divides into the numerator). In order to do integer division +divides into the numerator). +@ifset INTDIV +In order to do integer division or remainder with arbitrary precision integers, use the built-in -@code{intdiv()} function (@pxref{Numeric Functions}). +@code{intdiv0()} function (@pxref{Numeric Functions}). -You can simulate the @code{intdiv()} function in standard @command{awk} +You can simulate the @code{intdiv0()} function in standard @command{awk} using this user-defined function: @example @c file eg/lib/intdiv.awk -# intdiv --- do integer division +# intdiv0 --- do integer division @c endfile @ignore @@ -31050,12 +31054,15 @@ using this user-defined function: # # Name changed from div() to intdiv() # April, 2015 +# +# Changed to intdiv0() +# April, 2016 @c endfile @end ignore @c file eg/lib/intdiv.awk -function intdiv(numerator, denominator, result) +function intdiv0(numerator, denominator, result) @{ split("", result) @@ -31142,6 +31149,7 @@ because it's quite easy to modify for tiny memory devices with smallish word sizes. See @uref{http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899}. @end quotation +@end ifset @node Checking for MPFR @section How To Check If MPFR Is Available @@ -36248,10 +36256,12 @@ The @code{bindtextdomain()}, @code{dcgettext()}, and @code{dcngettext()} functions for internationalization (@pxref{Programmer i18n}) +@ifset INTDIV @item -The @code{intdiv()} function for doing integer +The @code{intdiv0()} function for doing integer division and remainder (@pxref{Numeric Functions}) +@end ifset @end itemize @item @@ -37047,9 +37057,11 @@ The @command{igawk} program and its manual page are no longer installed when @command{gawk} is built. @xref{Igawk Program}. +@ifset INTDIV @item -The @code{intdiv()} function. +The @code{intdiv0()} function. @xref{Numeric Functions}. +@end ifset @item The maximum number of hexadecimal digits in @samp{\x} escapes |