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 f6b6674f..e63aefae 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -27,6 +27,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 5684d7b7..0e03662b 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 ---------- @@ -27579,9 +27509,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 @@ -28046,8 +27973,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::. @@ -34459,8 +34384,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. @@ -34610,9 +34533,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) @@ -35076,12 +34999,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) @@ -35259,7 +35182,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) @@ -35363,8 +35286,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) @@ -35414,10 +35337,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) @@ -35982,341 +35905,341 @@ Node: Functions521910 Node: Built-in522948 Node: Calling Built-in524029 Node: Numeric Functions526025 -Ref: Numeric Functions-Footnote-1530970 -Ref: Numeric Functions-Footnote-2531327 -Ref: Numeric Functions-Footnote-3531375 -Node: String Functions531647 -Ref: String Functions-Footnote-1555305 -Ref: String Functions-Footnote-2555433 -Ref: String Functions-Footnote-3555681 -Node: Gory Details555768 -Ref: table-sub-escapes557559 -Ref: table-sub-proposed559078 -Ref: table-posix-sub560441 -Ref: table-gensub-escapes561982 -Ref: Gory Details-Footnote-1562805 -Node: I/O Functions562959 -Ref: table-system-return-values569541 -Ref: I/O Functions-Footnote-1571521 -Ref: I/O Functions-Footnote-2571669 -Node: Time Functions571789 -Ref: Time Functions-Footnote-1582456 -Ref: Time Functions-Footnote-2582524 -Ref: Time Functions-Footnote-3582682 -Ref: Time Functions-Footnote-4582793 -Ref: Time Functions-Footnote-5582905 -Ref: Time Functions-Footnote-6583132 -Node: Bitwise Functions583398 -Ref: table-bitwise-ops583992 -Ref: Bitwise Functions-Footnote-1590025 -Ref: Bitwise Functions-Footnote-2590198 -Node: Type Functions590389 -Node: I18N Functions593064 -Node: User-defined594715 -Node: Definition Syntax595520 -Ref: Definition Syntax-Footnote-1601207 -Node: Function Example601278 -Ref: Function Example-Footnote-1604200 -Node: Function Caveats604222 -Node: Calling A Function604740 -Node: Variable Scope605698 -Node: Pass By Value/Reference608692 -Node: Return Statement612191 -Node: Dynamic Typing615170 -Node: Indirect Calls616100 -Ref: Indirect Calls-Footnote-1626351 -Node: Functions Summary626479 -Node: Library Functions629184 -Ref: Library Functions-Footnote-1632791 -Ref: Library Functions-Footnote-2632934 -Node: Library Names633105 -Ref: Library Names-Footnote-1636565 -Ref: Library Names-Footnote-2636788 -Node: General Functions636874 -Node: Strtonum Function637977 -Node: Assert Function640999 -Node: Round Function644325 -Node: Cliff Random Function645866 -Node: Ordinal Functions646882 -Ref: Ordinal Functions-Footnote-1649945 -Ref: Ordinal Functions-Footnote-2650197 -Node: Join Function650407 -Ref: Join Function-Footnote-1652177 -Node: Getlocaltime Function652377 -Node: Readfile Function656119 -Node: Shell Quoting658091 -Node: Data File Management659492 -Node: Filetrans Function660124 -Node: Rewind Function664220 -Node: File Checking666126 -Ref: File Checking-Footnote-1667460 -Node: Empty Files667661 -Node: Ignoring Assigns669640 -Node: Getopt Function671190 -Ref: Getopt Function-Footnote-1682659 -Node: Passwd Functions682859 -Ref: Passwd Functions-Footnote-1691698 -Node: Group Functions691786 -Ref: Group Functions-Footnote-1699684 -Node: Walking Arrays699891 -Node: Library Functions Summary702899 -Node: Library Exercises704305 -Node: Sample Programs704770 -Node: Running Examples705540 -Node: Clones706268 -Node: Cut Program707492 -Node: Egrep Program717421 -Ref: Egrep Program-Footnote-1724933 -Node: Id Program725043 -Node: Split Program728723 -Ref: Split Program-Footnote-1732182 -Node: Tee Program732311 -Node: Uniq Program735101 -Node: Wc Program742527 -Ref: Wc Program-Footnote-1746782 -Node: Miscellaneous Programs746876 -Node: Dupword Program748089 -Node: Alarm Program750119 -Node: Translate Program754974 -Ref: Translate Program-Footnote-1759539 -Node: Labels Program759809 -Ref: Labels Program-Footnote-1763160 -Node: Word Sorting763244 -Node: History Sorting767316 -Node: Extract Program769151 -Node: Simple Sed776680 -Node: Igawk Program779754 -Ref: Igawk Program-Footnote-1794085 -Ref: Igawk Program-Footnote-2794287 -Ref: Igawk Program-Footnote-3794409 -Node: Anagram Program794524 -Node: Signature Program797586 -Node: Programs Summary798833 -Node: Programs Exercises800047 -Ref: Programs Exercises-Footnote-1804176 -Node: Advanced Features804267 -Node: Nondecimal Data806257 -Node: Array Sorting807848 -Node: Controlling Array Traversal808548 -Ref: Controlling Array Traversal-Footnote-1816915 -Node: Array Sorting Functions817033 -Ref: Array Sorting Functions-Footnote-1822124 -Node: Two-way I/O822320 -Ref: Two-way I/O-Footnote-1828871 -Ref: Two-way I/O-Footnote-2829058 -Node: TCP/IP Networking829140 -Node: Profiling832258 -Ref: Profiling-Footnote-1840930 -Node: Advanced Features Summary841253 -Node: Internationalization843097 -Node: I18N and L10N844577 -Node: Explaining gettext845264 -Ref: Explaining gettext-Footnote-1851156 -Ref: Explaining gettext-Footnote-2851341 -Node: Programmer i18n851506 -Ref: Programmer i18n-Footnote-1856455 -Node: Translator i18n856504 -Node: String Extraction857298 -Ref: String Extraction-Footnote-1858430 -Node: Printf Ordering858516 -Ref: Printf Ordering-Footnote-1861302 -Node: I18N Portability861366 -Ref: I18N Portability-Footnote-1863822 -Node: I18N Example863885 -Ref: I18N Example-Footnote-1866691 -Node: Gawk I18N866764 -Node: I18N Summary867409 -Node: Debugger868750 -Node: Debugging869772 -Node: Debugging Concepts870213 -Node: Debugging Terms872022 -Node: Awk Debugging874597 -Node: Sample Debugging Session875503 -Node: Debugger Invocation876037 -Node: Finding The Bug877423 -Node: List of Debugger Commands883901 -Node: Breakpoint Control885234 -Node: Debugger Execution Control888928 -Node: Viewing And Changing Data892290 -Node: Execution Stack895664 -Node: Debugger Info897301 -Node: Miscellaneous Debugger Commands901372 -Node: Readline Support906460 -Node: Limitations907356 -Node: Debugging Summary909465 -Node: Arbitrary Precision Arithmetic910744 -Node: Computer Arithmetic912229 -Ref: table-numeric-ranges915820 -Ref: Computer Arithmetic-Footnote-1916542 -Node: Math Definitions916599 -Ref: table-ieee-formats919913 -Ref: Math Definitions-Footnote-1920516 -Node: MPFR features920621 -Node: FP Math Caution922338 -Ref: FP Math Caution-Footnote-1923410 -Node: Inexactness of computations923779 -Node: Inexact representation924739 -Node: Comparing FP Values926099 -Node: Errors accumulate927181 -Node: Getting Accuracy928614 -Node: Try To Round931324 -Node: Setting precision932223 -Ref: table-predefined-precision-strings932920 -Node: Setting the rounding mode934750 -Ref: table-gawk-rounding-modes935124 -Ref: Setting the rounding mode-Footnote-1938532 -Node: Arbitrary Precision Integers938711 -Ref: Arbitrary Precision Integers-Footnote-1943616 -Node: Checking for MPFR943765 -Node: POSIX Floating Point Problems945062 -Ref: POSIX Floating Point Problems-Footnote-1948933 -Node: Floating point summary948971 -Node: Dynamic Extensions951161 -Node: Extension Intro952714 -Node: Plugin License953980 -Node: Extension Mechanism Outline954777 -Ref: figure-load-extension955216 -Ref: figure-register-new-function956781 -Ref: figure-call-new-function957873 -Node: Extension API Description959935 -Node: Extension API Functions Introduction961577 -Node: General Data Types966911 -Ref: General Data Types-Footnote-1974116 -Node: Memory Allocation Functions974415 -Ref: Memory Allocation Functions-Footnote-1977260 -Node: Constructor Functions977359 -Node: Registration Functions980358 -Node: Extension Functions981043 -Node: Exit Callback Functions986256 -Node: Extension Version String987506 -Node: Input Parsers988169 -Node: Output Wrappers1000876 -Node: Two-way processors1005388 -Node: Printing Messages1007653 -Ref: Printing Messages-Footnote-11008824 -Node: Updating ERRNO1008977 -Node: Requesting Values1009716 -Ref: table-value-types-returned1010453 -Node: Accessing Parameters1011389 -Node: Symbol Table Access1012624 -Node: Symbol table by name1013136 -Node: Symbol table by cookie1014925 -Ref: Symbol table by cookie-Footnote-11019110 -Node: Cached values1019174 -Ref: Cached values-Footnote-11022710 -Node: Array Manipulation1022801 -Ref: Array Manipulation-Footnote-11023892 -Node: Array Data Types1023929 -Ref: Array Data Types-Footnote-11026587 -Node: Array Functions1026679 -Node: Flattening Arrays1031078 -Node: Creating Arrays1038019 -Node: Redirection API1042788 -Node: Extension API Variables1045630 -Node: Extension Versioning1046263 -Ref: gawk-api-version1046700 -Node: Extension API Informational Variables1048428 -Node: Extension API Boilerplate1049492 -Node: Changes from API V11053354 -Node: Finding Extensions1054014 -Node: Extension Example1054573 -Node: Internal File Description1055371 -Node: Internal File Ops1059451 -Ref: Internal File Ops-Footnote-11070851 -Node: Using Internal File Ops1070991 -Ref: Using Internal File Ops-Footnote-11073374 -Node: Extension Samples1073648 -Node: Extension Sample File Functions1075177 -Node: Extension Sample Fnmatch1082826 -Node: Extension Sample Fork1084313 -Node: Extension Sample Inplace1085531 -Node: Extension Sample Ord1088741 -Node: Extension Sample Readdir1089577 -Ref: table-readdir-file-types1090466 -Node: Extension Sample Revout1091271 -Node: Extension Sample Rev2way1091860 -Node: Extension Sample Read write array1092600 -Node: Extension Sample Readfile1094542 -Node: Extension Sample Time1095637 -Node: Extension Sample API Tests1096985 -Node: gawkextlib1097477 -Node: Extension summary1099924 -Node: Extension Exercises1103626 -Node: Language History1105124 -Node: V7/SVR3.11106780 -Node: SVR41108932 -Node: POSIX1110366 -Node: BTL1111745 -Node: POSIX/GNU1112474 -Node: Feature History1118366 -Node: Common Extensions1132790 -Node: Ranges and Locales1134073 -Ref: Ranges and Locales-Footnote-11138689 -Ref: Ranges and Locales-Footnote-21138716 -Ref: Ranges and Locales-Footnote-31138951 -Node: Contributors1139172 -Node: History summary1144732 -Node: Installation1146112 -Node: Gawk Distribution1147056 -Node: Getting1147540 -Node: Extracting1148501 -Node: Distribution contents1150139 -Node: Unix Installation1156481 -Node: Quick Installation1157163 -Node: Shell Startup Files1159577 -Node: Additional Configuration Options1160666 -Node: Configuration Philosophy1162655 -Node: Non-Unix Installation1165024 -Node: PC Installation1165484 -Node: PC Binary Installation1166322 -Node: PC Compiling1166757 -Node: PC Using1167874 -Node: Cygwin1170919 -Node: MSYS1171689 -Node: VMS Installation1172190 -Node: VMS Compilation1172981 -Ref: VMS Compilation-Footnote-11174210 -Node: VMS Dynamic Extensions1174268 -Node: VMS Installation Details1175953 -Node: VMS Running1178206 -Node: VMS GNV1182485 -Node: VMS Old Gawk1183220 -Node: Bugs1183691 -Node: Bug address1184354 -Node: Usenet1186751 -Node: Maintainers1187528 -Node: Other Versions1188904 -Node: Installation summary1195488 -Node: Notes1196523 -Node: Compatibility Mode1197388 -Node: Additions1198170 -Node: Accessing The Source1199095 -Node: Adding Code1200530 -Node: New Ports1206748 -Node: Derived Files1211236 -Ref: Derived Files-Footnote-11216721 -Ref: Derived Files-Footnote-21216756 -Ref: Derived Files-Footnote-31217354 -Node: Future Extensions1217468 -Node: Implementation Limitations1218126 -Node: Extension Design1219309 -Node: Old Extension Problems1220463 -Ref: Old Extension Problems-Footnote-11221981 -Node: Extension New Mechanism Goals1222038 -Ref: Extension New Mechanism Goals-Footnote-11225402 -Node: Extension Other Design Decisions1225591 -Node: Extension Future Growth1227704 -Node: Old Extension Mechanism1228540 -Node: Notes summary1230303 -Node: Basic Concepts1231485 -Node: Basic High Level1232166 -Ref: figure-general-flow1232448 -Ref: figure-process-flow1233133 -Ref: Basic High Level-Footnote-11236434 -Node: Basic Data Typing1236619 -Node: Glossary1239947 -Node: Copying1271894 -Node: GNU Free Documentation License1309433 -Node: Index1334551 +Ref: Numeric Functions-Footnote-1530053 +Ref: Numeric Functions-Footnote-2530410 +Ref: Numeric Functions-Footnote-3530458 +Node: String Functions530730 +Ref: String Functions-Footnote-1554388 +Ref: String Functions-Footnote-2554516 +Ref: String Functions-Footnote-3554764 +Node: Gory Details554851 +Ref: table-sub-escapes556642 +Ref: table-sub-proposed558161 +Ref: table-posix-sub559524 +Ref: table-gensub-escapes561065 +Ref: Gory Details-Footnote-1561888 +Node: I/O Functions562042 +Ref: table-system-return-values568624 +Ref: I/O Functions-Footnote-1570604 +Ref: I/O Functions-Footnote-2570752 +Node: Time Functions570872 +Ref: Time Functions-Footnote-1581539 +Ref: Time Functions-Footnote-2581607 +Ref: Time Functions-Footnote-3581765 +Ref: Time Functions-Footnote-4581876 +Ref: Time Functions-Footnote-5581988 +Ref: Time Functions-Footnote-6582215 +Node: Bitwise Functions582481 +Ref: table-bitwise-ops583075 +Ref: Bitwise Functions-Footnote-1589108 +Ref: Bitwise Functions-Footnote-2589281 +Node: Type Functions589472 +Node: I18N Functions592147 +Node: User-defined593798 +Node: Definition Syntax594603 +Ref: Definition Syntax-Footnote-1600290 +Node: Function Example600361 +Ref: Function Example-Footnote-1603283 +Node: Function Caveats603305 +Node: Calling A Function603823 +Node: Variable Scope604781 +Node: Pass By Value/Reference607775 +Node: Return Statement611274 +Node: Dynamic Typing614253 +Node: Indirect Calls615183 +Ref: Indirect Calls-Footnote-1625434 +Node: Functions Summary625562 +Node: Library Functions628267 +Ref: Library Functions-Footnote-1631874 +Ref: Library Functions-Footnote-2632017 +Node: Library Names632188 +Ref: Library Names-Footnote-1635648 +Ref: Library Names-Footnote-2635871 +Node: General Functions635957 +Node: Strtonum Function637060 +Node: Assert Function640082 +Node: Round Function643408 +Node: Cliff Random Function644949 +Node: Ordinal Functions645965 +Ref: Ordinal Functions-Footnote-1649028 +Ref: Ordinal Functions-Footnote-2649280 +Node: Join Function649490 +Ref: Join Function-Footnote-1651260 +Node: Getlocaltime Function651460 +Node: Readfile Function655202 +Node: Shell Quoting657174 +Node: Data File Management658575 +Node: Filetrans Function659207 +Node: Rewind Function663303 +Node: File Checking665209 +Ref: File Checking-Footnote-1666543 +Node: Empty Files666744 +Node: Ignoring Assigns668723 +Node: Getopt Function670273 +Ref: Getopt Function-Footnote-1681742 +Node: Passwd Functions681942 +Ref: Passwd Functions-Footnote-1690781 +Node: Group Functions690869 +Ref: Group Functions-Footnote-1698767 +Node: Walking Arrays698974 +Node: Library Functions Summary701982 +Node: Library Exercises703388 +Node: Sample Programs703853 +Node: Running Examples704623 +Node: Clones705351 +Node: Cut Program706575 +Node: Egrep Program716504 +Ref: Egrep Program-Footnote-1724016 +Node: Id Program724126 +Node: Split Program727806 +Ref: Split Program-Footnote-1731265 +Node: Tee Program731394 +Node: Uniq Program734184 +Node: Wc Program741610 +Ref: Wc Program-Footnote-1745865 +Node: Miscellaneous Programs745959 +Node: Dupword Program747172 +Node: Alarm Program749202 +Node: Translate Program754057 +Ref: Translate Program-Footnote-1758622 +Node: Labels Program758892 +Ref: Labels Program-Footnote-1762243 +Node: Word Sorting762327 +Node: History Sorting766399 +Node: Extract Program768234 +Node: Simple Sed775763 +Node: Igawk Program778837 +Ref: Igawk Program-Footnote-1793168 +Ref: Igawk Program-Footnote-2793370 +Ref: Igawk Program-Footnote-3793492 +Node: Anagram Program793607 +Node: Signature Program796669 +Node: Programs Summary797916 +Node: Programs Exercises799130 +Ref: Programs Exercises-Footnote-1803259 +Node: Advanced Features803350 +Node: Nondecimal Data805340 +Node: Array Sorting806931 +Node: Controlling Array Traversal807631 +Ref: Controlling Array Traversal-Footnote-1815998 +Node: Array Sorting Functions816116 +Ref: Array Sorting Functions-Footnote-1821207 +Node: Two-way I/O821403 +Ref: Two-way I/O-Footnote-1827954 +Ref: Two-way I/O-Footnote-2828141 +Node: TCP/IP Networking828223 +Node: Profiling831341 +Ref: Profiling-Footnote-1840013 +Node: Advanced Features Summary840336 +Node: Internationalization842180 +Node: I18N and L10N843660 +Node: Explaining gettext844347 +Ref: Explaining gettext-Footnote-1850239 +Ref: Explaining gettext-Footnote-2850424 +Node: Programmer i18n850589 +Ref: Programmer i18n-Footnote-1855538 +Node: Translator i18n855587 +Node: String Extraction856381 +Ref: String Extraction-Footnote-1857513 +Node: Printf Ordering857599 +Ref: Printf Ordering-Footnote-1860385 +Node: I18N Portability860449 +Ref: I18N Portability-Footnote-1862905 +Node: I18N Example862968 +Ref: I18N Example-Footnote-1865774 +Node: Gawk I18N865847 +Node: I18N Summary866492 +Node: Debugger867833 +Node: Debugging868855 +Node: Debugging Concepts869296 +Node: Debugging Terms871105 +Node: Awk Debugging873680 +Node: Sample Debugging Session874586 +Node: Debugger Invocation875120 +Node: Finding The Bug876506 +Node: List of Debugger Commands882984 +Node: Breakpoint Control884317 +Node: Debugger Execution Control888011 +Node: Viewing And Changing Data891373 +Node: Execution Stack894747 +Node: Debugger Info896384 +Node: Miscellaneous Debugger Commands900455 +Node: Readline Support905543 +Node: Limitations906439 +Node: Debugging Summary908548 +Node: Arbitrary Precision Arithmetic909827 +Node: Computer Arithmetic911312 +Ref: table-numeric-ranges914903 +Ref: Computer Arithmetic-Footnote-1915625 +Node: Math Definitions915682 +Ref: table-ieee-formats918996 +Ref: Math Definitions-Footnote-1919599 +Node: MPFR features919704 +Node: FP Math Caution921421 +Ref: FP Math Caution-Footnote-1922493 +Node: Inexactness of computations922862 +Node: Inexact representation923822 +Node: Comparing FP Values925182 +Node: Errors accumulate926264 +Node: Getting Accuracy927697 +Node: Try To Round930407 +Node: Setting precision931306 +Ref: table-predefined-precision-strings932003 +Node: Setting the rounding mode933833 +Ref: table-gawk-rounding-modes934207 +Ref: Setting the rounding mode-Footnote-1937615 +Node: Arbitrary Precision Integers937794 +Ref: Arbitrary Precision Integers-Footnote-1940969 +Node: Checking for MPFR941118 +Node: POSIX Floating Point Problems942415 +Ref: POSIX Floating Point Problems-Footnote-1946286 +Node: Floating point summary946324 +Node: Dynamic Extensions948514 +Node: Extension Intro950067 +Node: Plugin License951333 +Node: Extension Mechanism Outline952130 +Ref: figure-load-extension952569 +Ref: figure-register-new-function954134 +Ref: figure-call-new-function955226 +Node: Extension API Description957288 +Node: Extension API Functions Introduction958930 +Node: General Data Types964264 +Ref: General Data Types-Footnote-1971469 +Node: Memory Allocation Functions971768 +Ref: Memory Allocation Functions-Footnote-1974613 +Node: Constructor Functions974712 +Node: Registration Functions977711 +Node: Extension Functions978396 +Node: Exit Callback Functions983609 +Node: Extension Version String984859 +Node: Input Parsers985522 +Node: Output Wrappers998229 +Node: Two-way processors1002741 +Node: Printing Messages1005006 +Ref: Printing Messages-Footnote-11006177 +Node: Updating ERRNO1006330 +Node: Requesting Values1007069 +Ref: table-value-types-returned1007806 +Node: Accessing Parameters1008742 +Node: Symbol Table Access1009977 +Node: Symbol table by name1010489 +Node: Symbol table by cookie1012278 +Ref: Symbol table by cookie-Footnote-11016463 +Node: Cached values1016527 +Ref: Cached values-Footnote-11020063 +Node: Array Manipulation1020154 +Ref: Array Manipulation-Footnote-11021245 +Node: Array Data Types1021282 +Ref: Array Data Types-Footnote-11023940 +Node: Array Functions1024032 +Node: Flattening Arrays1028431 +Node: Creating Arrays1035372 +Node: Redirection API1040141 +Node: Extension API Variables1042983 +Node: Extension Versioning1043616 +Ref: gawk-api-version1044053 +Node: Extension API Informational Variables1045781 +Node: Extension API Boilerplate1046845 +Node: Changes from API V11050707 +Node: Finding Extensions1051367 +Node: Extension Example1051926 +Node: Internal File Description1052724 +Node: Internal File Ops1056804 +Ref: Internal File Ops-Footnote-11068204 +Node: Using Internal File Ops1068344 +Ref: Using Internal File Ops-Footnote-11070727 +Node: Extension Samples1071001 +Node: Extension Sample File Functions1072530 +Node: Extension Sample Fnmatch1080179 +Node: Extension Sample Fork1081666 +Node: Extension Sample Inplace1082884 +Node: Extension Sample Ord1086094 +Node: Extension Sample Readdir1086930 +Ref: table-readdir-file-types1087819 +Node: Extension Sample Revout1088624 +Node: Extension Sample Rev2way1089213 +Node: Extension Sample Read write array1089953 +Node: Extension Sample Readfile1091895 +Node: Extension Sample Time1092990 +Node: Extension Sample API Tests1094338 +Node: gawkextlib1094830 +Node: Extension summary1097277 +Node: Extension Exercises1100979 +Node: Language History1102477 +Node: V7/SVR3.11104133 +Node: SVR41106285 +Node: POSIX1107719 +Node: BTL1109098 +Node: POSIX/GNU1109827 +Node: Feature History1115605 +Node: Common Extensions1129970 +Node: Ranges and Locales1131253 +Ref: Ranges and Locales-Footnote-11135869 +Ref: Ranges and Locales-Footnote-21135896 +Ref: Ranges and Locales-Footnote-31136131 +Node: Contributors1136352 +Node: History summary1141912 +Node: Installation1143292 +Node: Gawk Distribution1144236 +Node: Getting1144720 +Node: Extracting1145681 +Node: Distribution contents1147319 +Node: Unix Installation1153661 +Node: Quick Installation1154343 +Node: Shell Startup Files1156757 +Node: Additional Configuration Options1157846 +Node: Configuration Philosophy1159835 +Node: Non-Unix Installation1162204 +Node: PC Installation1162664 +Node: PC Binary Installation1163502 +Node: PC Compiling1163937 +Node: PC Using1165054 +Node: Cygwin1168099 +Node: MSYS1168869 +Node: VMS Installation1169370 +Node: VMS Compilation1170161 +Ref: VMS Compilation-Footnote-11171390 +Node: VMS Dynamic Extensions1171448 +Node: VMS Installation Details1173133 +Node: VMS Running1175386 +Node: VMS GNV1179665 +Node: VMS Old Gawk1180400 +Node: Bugs1180871 +Node: Bug address1181534 +Node: Usenet1183931 +Node: Maintainers1184708 +Node: Other Versions1186084 +Node: Installation summary1192668 +Node: Notes1193703 +Node: Compatibility Mode1194568 +Node: Additions1195350 +Node: Accessing The Source1196275 +Node: Adding Code1197710 +Node: New Ports1203928 +Node: Derived Files1208416 +Ref: Derived Files-Footnote-11213901 +Ref: Derived Files-Footnote-21213936 +Ref: Derived Files-Footnote-31214534 +Node: Future Extensions1214648 +Node: Implementation Limitations1215306 +Node: Extension Design1216489 +Node: Old Extension Problems1217643 +Ref: Old Extension Problems-Footnote-11219161 +Node: Extension New Mechanism Goals1219218 +Ref: Extension New Mechanism Goals-Footnote-11222582 +Node: Extension Other Design Decisions1222771 +Node: Extension Future Growth1224884 +Node: Old Extension Mechanism1225720 +Node: Notes summary1227483 +Node: Basic Concepts1228665 +Node: Basic High Level1229346 +Ref: figure-general-flow1229628 +Ref: figure-process-flow1230313 +Ref: Basic High Level-Footnote-11233614 +Node: Basic Data Typing1233799 +Node: Glossary1237127 +Node: Copying1269074 +Node: GNU Free Documentation License1306613 +Node: Index1331731 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 46ef2716..d398c41b 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 @@ -37228,10 +37236,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 @@ -38027,9 +38037,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 17b98584..aee784f2 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 @@ -36242,10 +36250,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 @@ -37041,9 +37051,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 |