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 e610a6e3..8249c0be 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -19,6 +19,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 2ed1c733..b7b6b48c 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -12381,24 +12381,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, @@ -23196,59 +23178,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 ---------- @@ -27560,9 +27490,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 @@ -28025,8 +27952,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::. @@ -34437,8 +34362,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. @@ -34588,9 +34511,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) @@ -35054,12 +34977,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) @@ -35237,7 +35160,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) @@ -35341,8 +35264,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) @@ -35392,10 +35315,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) @@ -35960,341 +35883,341 @@ Node: Functions521041 Node: Built-in522079 Node: Calling Built-in523160 Node: Numeric Functions525156 -Ref: Numeric Functions-Footnote-1530101 -Ref: Numeric Functions-Footnote-2530458 -Ref: Numeric Functions-Footnote-3530506 -Node: String Functions530778 -Ref: String Functions-Footnote-1554436 -Ref: String Functions-Footnote-2554564 -Ref: String Functions-Footnote-3554812 -Node: Gory Details554899 -Ref: table-sub-escapes556690 -Ref: table-sub-proposed558209 -Ref: table-posix-sub559572 -Ref: table-gensub-escapes561113 -Ref: Gory Details-Footnote-1561936 -Node: I/O Functions562090 -Ref: table-system-return-values568672 -Ref: I/O Functions-Footnote-1570652 -Ref: I/O Functions-Footnote-2570800 -Node: Time Functions570920 -Ref: Time Functions-Footnote-1581587 -Ref: Time Functions-Footnote-2581655 -Ref: Time Functions-Footnote-3581813 -Ref: Time Functions-Footnote-4581924 -Ref: Time Functions-Footnote-5582036 -Ref: Time Functions-Footnote-6582263 -Node: Bitwise Functions582529 -Ref: table-bitwise-ops583123 -Ref: Bitwise Functions-Footnote-1589156 -Ref: Bitwise Functions-Footnote-2589329 -Node: Type Functions589520 -Node: I18N Functions592195 -Node: User-defined593846 -Node: Definition Syntax594651 -Ref: Definition Syntax-Footnote-1600338 -Node: Function Example600409 -Ref: Function Example-Footnote-1603331 -Node: Function Caveats603353 -Node: Calling A Function603871 -Node: Variable Scope604829 -Node: Pass By Value/Reference607823 -Node: Return Statement611322 -Node: Dynamic Typing614301 -Node: Indirect Calls615231 -Ref: Indirect Calls-Footnote-1625482 -Node: Functions Summary625610 -Node: Library Functions628315 -Ref: Library Functions-Footnote-1631922 -Ref: Library Functions-Footnote-2632065 -Node: Library Names632236 -Ref: Library Names-Footnote-1635696 -Ref: Library Names-Footnote-2635919 -Node: General Functions636005 -Node: Strtonum Function637108 -Node: Assert Function640130 -Node: Round Function643456 -Node: Cliff Random Function644997 -Node: Ordinal Functions646013 -Ref: Ordinal Functions-Footnote-1649076 -Ref: Ordinal Functions-Footnote-2649328 -Node: Join Function649538 -Ref: Join Function-Footnote-1651308 -Node: Getlocaltime Function651508 -Node: Readfile Function655250 -Node: Shell Quoting657222 -Node: Data File Management658623 -Node: Filetrans Function659255 -Node: Rewind Function663351 -Node: File Checking665257 -Ref: File Checking-Footnote-1666591 -Node: Empty Files666792 -Node: Ignoring Assigns668771 -Node: Getopt Function670321 -Ref: Getopt Function-Footnote-1681790 -Node: Passwd Functions681990 -Ref: Passwd Functions-Footnote-1690829 -Node: Group Functions690917 -Ref: Group Functions-Footnote-1698815 -Node: Walking Arrays699022 -Node: Library Functions Summary702030 -Node: Library Exercises703436 -Node: Sample Programs703901 -Node: Running Examples704671 -Node: Clones705399 -Node: Cut Program706623 -Node: Egrep Program716552 -Ref: Egrep Program-Footnote-1724064 -Node: Id Program724174 -Node: Split Program727854 -Ref: Split Program-Footnote-1731313 -Node: Tee Program731442 -Node: Uniq Program734232 -Node: Wc Program741658 -Ref: Wc Program-Footnote-1745913 -Node: Miscellaneous Programs746007 -Node: Dupword Program747220 -Node: Alarm Program749250 -Node: Translate Program754105 -Ref: Translate Program-Footnote-1758670 -Node: Labels Program758940 -Ref: Labels Program-Footnote-1762291 -Node: Word Sorting762375 -Node: History Sorting766447 -Node: Extract Program768282 -Node: Simple Sed775811 -Node: Igawk Program778885 -Ref: Igawk Program-Footnote-1793216 -Ref: Igawk Program-Footnote-2793418 -Ref: Igawk Program-Footnote-3793540 -Node: Anagram Program793655 -Node: Signature Program796717 -Node: Programs Summary797964 -Node: Programs Exercises799178 -Ref: Programs Exercises-Footnote-1803307 -Node: Advanced Features803398 -Node: Nondecimal Data805388 -Node: Array Sorting806979 -Node: Controlling Array Traversal807679 -Ref: Controlling Array Traversal-Footnote-1816046 -Node: Array Sorting Functions816164 -Ref: Array Sorting Functions-Footnote-1821255 -Node: Two-way I/O821451 -Ref: Two-way I/O-Footnote-1828002 -Ref: Two-way I/O-Footnote-2828189 -Node: TCP/IP Networking828271 -Node: Profiling831389 -Ref: Profiling-Footnote-1840061 -Node: Advanced Features Summary840384 -Node: Internationalization842228 -Node: I18N and L10N843708 -Node: Explaining gettext844395 -Ref: Explaining gettext-Footnote-1850287 -Ref: Explaining gettext-Footnote-2850472 -Node: Programmer i18n850637 -Ref: Programmer i18n-Footnote-1855586 -Node: Translator i18n855635 -Node: String Extraction856429 -Ref: String Extraction-Footnote-1857561 -Node: Printf Ordering857647 -Ref: Printf Ordering-Footnote-1860433 -Node: I18N Portability860497 -Ref: I18N Portability-Footnote-1862953 -Node: I18N Example863016 -Ref: I18N Example-Footnote-1865822 -Node: Gawk I18N865895 -Node: I18N Summary866540 -Node: Debugger867881 -Node: Debugging868903 -Node: Debugging Concepts869344 -Node: Debugging Terms871153 -Node: Awk Debugging873728 -Node: Sample Debugging Session874634 -Node: Debugger Invocation875168 -Node: Finding The Bug876554 -Node: List of Debugger Commands883032 -Node: Breakpoint Control884365 -Node: Debugger Execution Control888059 -Node: Viewing And Changing Data891421 -Node: Execution Stack894795 -Node: Debugger Info896432 -Node: Miscellaneous Debugger Commands900503 -Node: Readline Support905591 -Node: Limitations906487 -Node: Debugging Summary908596 -Node: Arbitrary Precision Arithmetic909875 -Node: Computer Arithmetic911360 -Ref: table-numeric-ranges914951 -Ref: Computer Arithmetic-Footnote-1915673 -Node: Math Definitions915730 -Ref: table-ieee-formats919044 -Ref: Math Definitions-Footnote-1919647 -Node: MPFR features919752 -Node: FP Math Caution921469 -Ref: FP Math Caution-Footnote-1922541 -Node: Inexactness of computations922910 -Node: Inexact representation923870 -Node: Comparing FP Values925230 -Node: Errors accumulate926312 -Node: Getting Accuracy927745 -Node: Try To Round930455 -Node: Setting precision931354 -Ref: table-predefined-precision-strings932051 -Node: Setting the rounding mode933881 -Ref: table-gawk-rounding-modes934255 -Ref: Setting the rounding mode-Footnote-1937663 -Node: Arbitrary Precision Integers937842 -Ref: Arbitrary Precision Integers-Footnote-1942747 -Node: Checking for MPFR942896 -Node: POSIX Floating Point Problems944193 -Ref: POSIX Floating Point Problems-Footnote-1948064 -Node: Floating point summary948102 -Node: Dynamic Extensions950292 -Node: Extension Intro951845 -Node: Plugin License953111 -Node: Extension Mechanism Outline953908 -Ref: figure-load-extension954347 -Ref: figure-register-new-function955912 -Ref: figure-call-new-function957004 -Node: Extension API Description959066 -Node: Extension API Functions Introduction960708 -Node: General Data Types966042 -Ref: General Data Types-Footnote-1973247 -Node: Memory Allocation Functions973546 -Ref: Memory Allocation Functions-Footnote-1976391 -Node: Constructor Functions976490 -Node: Registration Functions979489 -Node: Extension Functions980174 -Node: Exit Callback Functions985387 -Node: Extension Version String986637 -Node: Input Parsers987300 -Node: Output Wrappers1000007 -Node: Two-way processors1004519 -Node: Printing Messages1006784 -Ref: Printing Messages-Footnote-11007955 -Node: Updating ERRNO1008108 -Node: Requesting Values1008847 -Ref: table-value-types-returned1009584 -Node: Accessing Parameters1010520 -Node: Symbol Table Access1011755 -Node: Symbol table by name1012267 -Node: Symbol table by cookie1014056 -Ref: Symbol table by cookie-Footnote-11018241 -Node: Cached values1018305 -Ref: Cached values-Footnote-11021841 -Node: Array Manipulation1021932 -Ref: Array Manipulation-Footnote-11023023 -Node: Array Data Types1023060 -Ref: Array Data Types-Footnote-11025718 -Node: Array Functions1025810 -Node: Flattening Arrays1030209 -Node: Creating Arrays1037150 -Node: Redirection API1041919 -Node: Extension API Variables1044761 -Node: Extension Versioning1045394 -Ref: gawk-api-version1045831 -Node: Extension API Informational Variables1047559 -Node: Extension API Boilerplate1048623 -Node: Changes from API V11052485 -Node: Finding Extensions1053145 -Node: Extension Example1053704 -Node: Internal File Description1054502 -Node: Internal File Ops1058582 -Ref: Internal File Ops-Footnote-11069982 -Node: Using Internal File Ops1070122 -Ref: Using Internal File Ops-Footnote-11072505 -Node: Extension Samples1072779 -Node: Extension Sample File Functions1074308 -Node: Extension Sample Fnmatch1081957 -Node: Extension Sample Fork1083444 -Node: Extension Sample Inplace1084662 -Node: Extension Sample Ord1087872 -Node: Extension Sample Readdir1088708 -Ref: table-readdir-file-types1089597 -Node: Extension Sample Revout1090402 -Node: Extension Sample Rev2way1090991 -Node: Extension Sample Read write array1091731 -Node: Extension Sample Readfile1093673 -Node: Extension Sample Time1094768 -Node: Extension Sample API Tests1096116 -Node: gawkextlib1096608 -Node: Extension summary1099055 -Node: Extension Exercises1102757 -Node: Language History1104255 -Node: V7/SVR3.11105911 -Node: SVR41108063 -Node: POSIX1109497 -Node: BTL1110876 -Node: POSIX/GNU1111605 -Node: Feature History1117497 -Node: Common Extensions1131867 -Node: Ranges and Locales1133150 -Ref: Ranges and Locales-Footnote-11137766 -Ref: Ranges and Locales-Footnote-21137793 -Ref: Ranges and Locales-Footnote-31138028 -Node: Contributors1138249 -Node: History summary1143809 -Node: Installation1145189 -Node: Gawk Distribution1146133 -Node: Getting1146617 -Node: Extracting1147578 -Node: Distribution contents1149216 -Node: Unix Installation1155558 -Node: Quick Installation1156240 -Node: Shell Startup Files1158654 -Node: Additional Configuration Options1159743 -Node: Configuration Philosophy1161732 -Node: Non-Unix Installation1164101 -Node: PC Installation1164561 -Node: PC Binary Installation1165399 -Node: PC Compiling1165834 -Node: PC Using1166951 -Node: Cygwin1169996 -Node: MSYS1170766 -Node: VMS Installation1171267 -Node: VMS Compilation1172058 -Ref: VMS Compilation-Footnote-11173287 -Node: VMS Dynamic Extensions1173345 -Node: VMS Installation Details1175030 -Node: VMS Running1177283 -Node: VMS GNV1181562 -Node: VMS Old Gawk1182297 -Node: Bugs1182768 -Node: Bug address1183431 -Node: Usenet1185828 -Node: Maintainers1186605 -Node: Other Versions1187981 -Node: Installation summary1194565 -Node: Notes1195600 -Node: Compatibility Mode1196465 -Node: Additions1197247 -Node: Accessing The Source1198172 -Node: Adding Code1199607 -Node: New Ports1205825 -Node: Derived Files1210313 -Ref: Derived Files-Footnote-11215798 -Ref: Derived Files-Footnote-21215833 -Ref: Derived Files-Footnote-31216431 -Node: Future Extensions1216545 -Node: Implementation Limitations1217203 -Node: Extension Design1218386 -Node: Old Extension Problems1219540 -Ref: Old Extension Problems-Footnote-11221058 -Node: Extension New Mechanism Goals1221115 -Ref: Extension New Mechanism Goals-Footnote-11224479 -Node: Extension Other Design Decisions1224668 -Node: Extension Future Growth1226781 -Node: Old Extension Mechanism1227617 -Node: Notes summary1229380 -Node: Basic Concepts1230562 -Node: Basic High Level1231243 -Ref: figure-general-flow1231525 -Ref: figure-process-flow1232210 -Ref: Basic High Level-Footnote-11235511 -Node: Basic Data Typing1235696 -Node: Glossary1239024 -Node: Copying1270971 -Node: GNU Free Documentation License1308510 -Node: Index1333628 +Ref: Numeric Functions-Footnote-1529184 +Ref: Numeric Functions-Footnote-2529541 +Ref: Numeric Functions-Footnote-3529589 +Node: String Functions529861 +Ref: String Functions-Footnote-1553519 +Ref: String Functions-Footnote-2553647 +Ref: String Functions-Footnote-3553895 +Node: Gory Details553982 +Ref: table-sub-escapes555773 +Ref: table-sub-proposed557292 +Ref: table-posix-sub558655 +Ref: table-gensub-escapes560196 +Ref: Gory Details-Footnote-1561019 +Node: I/O Functions561173 +Ref: table-system-return-values567755 +Ref: I/O Functions-Footnote-1569735 +Ref: I/O Functions-Footnote-2569883 +Node: Time Functions570003 +Ref: Time Functions-Footnote-1580670 +Ref: Time Functions-Footnote-2580738 +Ref: Time Functions-Footnote-3580896 +Ref: Time Functions-Footnote-4581007 +Ref: Time Functions-Footnote-5581119 +Ref: Time Functions-Footnote-6581346 +Node: Bitwise Functions581612 +Ref: table-bitwise-ops582206 +Ref: Bitwise Functions-Footnote-1588239 +Ref: Bitwise Functions-Footnote-2588412 +Node: Type Functions588603 +Node: I18N Functions591278 +Node: User-defined592929 +Node: Definition Syntax593734 +Ref: Definition Syntax-Footnote-1599421 +Node: Function Example599492 +Ref: Function Example-Footnote-1602414 +Node: Function Caveats602436 +Node: Calling A Function602954 +Node: Variable Scope603912 +Node: Pass By Value/Reference606906 +Node: Return Statement610405 +Node: Dynamic Typing613384 +Node: Indirect Calls614314 +Ref: Indirect Calls-Footnote-1624565 +Node: Functions Summary624693 +Node: Library Functions627398 +Ref: Library Functions-Footnote-1631005 +Ref: Library Functions-Footnote-2631148 +Node: Library Names631319 +Ref: Library Names-Footnote-1634779 +Ref: Library Names-Footnote-2635002 +Node: General Functions635088 +Node: Strtonum Function636191 +Node: Assert Function639213 +Node: Round Function642539 +Node: Cliff Random Function644080 +Node: Ordinal Functions645096 +Ref: Ordinal Functions-Footnote-1648159 +Ref: Ordinal Functions-Footnote-2648411 +Node: Join Function648621 +Ref: Join Function-Footnote-1650391 +Node: Getlocaltime Function650591 +Node: Readfile Function654333 +Node: Shell Quoting656305 +Node: Data File Management657706 +Node: Filetrans Function658338 +Node: Rewind Function662434 +Node: File Checking664340 +Ref: File Checking-Footnote-1665674 +Node: Empty Files665875 +Node: Ignoring Assigns667854 +Node: Getopt Function669404 +Ref: Getopt Function-Footnote-1680873 +Node: Passwd Functions681073 +Ref: Passwd Functions-Footnote-1689912 +Node: Group Functions690000 +Ref: Group Functions-Footnote-1697898 +Node: Walking Arrays698105 +Node: Library Functions Summary701113 +Node: Library Exercises702519 +Node: Sample Programs702984 +Node: Running Examples703754 +Node: Clones704482 +Node: Cut Program705706 +Node: Egrep Program715635 +Ref: Egrep Program-Footnote-1723147 +Node: Id Program723257 +Node: Split Program726937 +Ref: Split Program-Footnote-1730396 +Node: Tee Program730525 +Node: Uniq Program733315 +Node: Wc Program740741 +Ref: Wc Program-Footnote-1744996 +Node: Miscellaneous Programs745090 +Node: Dupword Program746303 +Node: Alarm Program748333 +Node: Translate Program753188 +Ref: Translate Program-Footnote-1757753 +Node: Labels Program758023 +Ref: Labels Program-Footnote-1761374 +Node: Word Sorting761458 +Node: History Sorting765530 +Node: Extract Program767365 +Node: Simple Sed774894 +Node: Igawk Program777968 +Ref: Igawk Program-Footnote-1792299 +Ref: Igawk Program-Footnote-2792501 +Ref: Igawk Program-Footnote-3792623 +Node: Anagram Program792738 +Node: Signature Program795800 +Node: Programs Summary797047 +Node: Programs Exercises798261 +Ref: Programs Exercises-Footnote-1802390 +Node: Advanced Features802481 +Node: Nondecimal Data804471 +Node: Array Sorting806062 +Node: Controlling Array Traversal806762 +Ref: Controlling Array Traversal-Footnote-1815129 +Node: Array Sorting Functions815247 +Ref: Array Sorting Functions-Footnote-1820338 +Node: Two-way I/O820534 +Ref: Two-way I/O-Footnote-1827085 +Ref: Two-way I/O-Footnote-2827272 +Node: TCP/IP Networking827354 +Node: Profiling830472 +Ref: Profiling-Footnote-1839144 +Node: Advanced Features Summary839467 +Node: Internationalization841311 +Node: I18N and L10N842791 +Node: Explaining gettext843478 +Ref: Explaining gettext-Footnote-1849370 +Ref: Explaining gettext-Footnote-2849555 +Node: Programmer i18n849720 +Ref: Programmer i18n-Footnote-1854669 +Node: Translator i18n854718 +Node: String Extraction855512 +Ref: String Extraction-Footnote-1856644 +Node: Printf Ordering856730 +Ref: Printf Ordering-Footnote-1859516 +Node: I18N Portability859580 +Ref: I18N Portability-Footnote-1862036 +Node: I18N Example862099 +Ref: I18N Example-Footnote-1864905 +Node: Gawk I18N864978 +Node: I18N Summary865623 +Node: Debugger866964 +Node: Debugging867986 +Node: Debugging Concepts868427 +Node: Debugging Terms870236 +Node: Awk Debugging872811 +Node: Sample Debugging Session873717 +Node: Debugger Invocation874251 +Node: Finding The Bug875637 +Node: List of Debugger Commands882115 +Node: Breakpoint Control883448 +Node: Debugger Execution Control887142 +Node: Viewing And Changing Data890504 +Node: Execution Stack893878 +Node: Debugger Info895515 +Node: Miscellaneous Debugger Commands899586 +Node: Readline Support904674 +Node: Limitations905570 +Node: Debugging Summary907679 +Node: Arbitrary Precision Arithmetic908958 +Node: Computer Arithmetic910443 +Ref: table-numeric-ranges914034 +Ref: Computer Arithmetic-Footnote-1914756 +Node: Math Definitions914813 +Ref: table-ieee-formats918127 +Ref: Math Definitions-Footnote-1918730 +Node: MPFR features918835 +Node: FP Math Caution920552 +Ref: FP Math Caution-Footnote-1921624 +Node: Inexactness of computations921993 +Node: Inexact representation922953 +Node: Comparing FP Values924313 +Node: Errors accumulate925395 +Node: Getting Accuracy926828 +Node: Try To Round929538 +Node: Setting precision930437 +Ref: table-predefined-precision-strings931134 +Node: Setting the rounding mode932964 +Ref: table-gawk-rounding-modes933338 +Ref: Setting the rounding mode-Footnote-1936746 +Node: Arbitrary Precision Integers936925 +Ref: Arbitrary Precision Integers-Footnote-1940100 +Node: Checking for MPFR940249 +Node: POSIX Floating Point Problems941546 +Ref: POSIX Floating Point Problems-Footnote-1945417 +Node: Floating point summary945455 +Node: Dynamic Extensions947645 +Node: Extension Intro949198 +Node: Plugin License950464 +Node: Extension Mechanism Outline951261 +Ref: figure-load-extension951700 +Ref: figure-register-new-function953265 +Ref: figure-call-new-function954357 +Node: Extension API Description956419 +Node: Extension API Functions Introduction958061 +Node: General Data Types963395 +Ref: General Data Types-Footnote-1970600 +Node: Memory Allocation Functions970899 +Ref: Memory Allocation Functions-Footnote-1973744 +Node: Constructor Functions973843 +Node: Registration Functions976842 +Node: Extension Functions977527 +Node: Exit Callback Functions982740 +Node: Extension Version String983990 +Node: Input Parsers984653 +Node: Output Wrappers997360 +Node: Two-way processors1001872 +Node: Printing Messages1004137 +Ref: Printing Messages-Footnote-11005308 +Node: Updating ERRNO1005461 +Node: Requesting Values1006200 +Ref: table-value-types-returned1006937 +Node: Accessing Parameters1007873 +Node: Symbol Table Access1009108 +Node: Symbol table by name1009620 +Node: Symbol table by cookie1011409 +Ref: Symbol table by cookie-Footnote-11015594 +Node: Cached values1015658 +Ref: Cached values-Footnote-11019194 +Node: Array Manipulation1019285 +Ref: Array Manipulation-Footnote-11020376 +Node: Array Data Types1020413 +Ref: Array Data Types-Footnote-11023071 +Node: Array Functions1023163 +Node: Flattening Arrays1027562 +Node: Creating Arrays1034503 +Node: Redirection API1039272 +Node: Extension API Variables1042114 +Node: Extension Versioning1042747 +Ref: gawk-api-version1043184 +Node: Extension API Informational Variables1044912 +Node: Extension API Boilerplate1045976 +Node: Changes from API V11049838 +Node: Finding Extensions1050498 +Node: Extension Example1051057 +Node: Internal File Description1051855 +Node: Internal File Ops1055935 +Ref: Internal File Ops-Footnote-11067335 +Node: Using Internal File Ops1067475 +Ref: Using Internal File Ops-Footnote-11069858 +Node: Extension Samples1070132 +Node: Extension Sample File Functions1071661 +Node: Extension Sample Fnmatch1079310 +Node: Extension Sample Fork1080797 +Node: Extension Sample Inplace1082015 +Node: Extension Sample Ord1085225 +Node: Extension Sample Readdir1086061 +Ref: table-readdir-file-types1086950 +Node: Extension Sample Revout1087755 +Node: Extension Sample Rev2way1088344 +Node: Extension Sample Read write array1089084 +Node: Extension Sample Readfile1091026 +Node: Extension Sample Time1092121 +Node: Extension Sample API Tests1093469 +Node: gawkextlib1093961 +Node: Extension summary1096408 +Node: Extension Exercises1100110 +Node: Language History1101608 +Node: V7/SVR3.11103264 +Node: SVR41105416 +Node: POSIX1106850 +Node: BTL1108229 +Node: POSIX/GNU1108958 +Node: Feature History1114736 +Node: Common Extensions1129047 +Node: Ranges and Locales1130330 +Ref: Ranges and Locales-Footnote-11134946 +Ref: Ranges and Locales-Footnote-21134973 +Ref: Ranges and Locales-Footnote-31135208 +Node: Contributors1135429 +Node: History summary1140989 +Node: Installation1142369 +Node: Gawk Distribution1143313 +Node: Getting1143797 +Node: Extracting1144758 +Node: Distribution contents1146396 +Node: Unix Installation1152738 +Node: Quick Installation1153420 +Node: Shell Startup Files1155834 +Node: Additional Configuration Options1156923 +Node: Configuration Philosophy1158912 +Node: Non-Unix Installation1161281 +Node: PC Installation1161741 +Node: PC Binary Installation1162579 +Node: PC Compiling1163014 +Node: PC Using1164131 +Node: Cygwin1167176 +Node: MSYS1167946 +Node: VMS Installation1168447 +Node: VMS Compilation1169238 +Ref: VMS Compilation-Footnote-11170467 +Node: VMS Dynamic Extensions1170525 +Node: VMS Installation Details1172210 +Node: VMS Running1174463 +Node: VMS GNV1178742 +Node: VMS Old Gawk1179477 +Node: Bugs1179948 +Node: Bug address1180611 +Node: Usenet1183008 +Node: Maintainers1183785 +Node: Other Versions1185161 +Node: Installation summary1191745 +Node: Notes1192780 +Node: Compatibility Mode1193645 +Node: Additions1194427 +Node: Accessing The Source1195352 +Node: Adding Code1196787 +Node: New Ports1203005 +Node: Derived Files1207493 +Ref: Derived Files-Footnote-11212978 +Ref: Derived Files-Footnote-21213013 +Ref: Derived Files-Footnote-31213611 +Node: Future Extensions1213725 +Node: Implementation Limitations1214383 +Node: Extension Design1215566 +Node: Old Extension Problems1216720 +Ref: Old Extension Problems-Footnote-11218238 +Node: Extension New Mechanism Goals1218295 +Ref: Extension New Mechanism Goals-Footnote-11221659 +Node: Extension Other Design Decisions1221848 +Node: Extension Future Growth1223961 +Node: Old Extension Mechanism1224797 +Node: Notes summary1226560 +Node: Basic Concepts1227742 +Node: Basic High Level1228423 +Ref: figure-general-flow1228705 +Ref: figure-process-flow1229390 +Ref: Basic High Level-Footnote-11232691 +Node: Basic Data Typing1232876 +Node: Glossary1236204 +Node: Copying1268151 +Node: GNU Free Documentation License1305690 +Node: Index1330808 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index e7d75521..87e46a5e 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -17564,9 +17564,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} @@ -17584,6 +17585,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} @@ -32014,16 +32016,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 @@ -32034,12 +32038,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) @@ -32126,6 +32133,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 @@ -37226,10 +37234,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 @@ -38021,9 +38031,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 f95360d2..402caede 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -16837,9 +16837,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} @@ -16857,6 +16858,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} @@ -31028,16 +31030,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 @@ -31048,12 +31052,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) @@ -31140,6 +31147,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 @@ -36240,10 +36248,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 @@ -37035,9 +37045,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 |